Section 1
//ArtHavoc (ArtHavoc)
package {
import flash.events.*;
import flash.display.*;
import flash.net.*;
public class ArtHavoc extends Sprite {
private var urlAH:URLRequest;
private var artHavoc:ArtHavocLink;
public function ArtHavoc(){
super();
init();
}
private function init():void{
urlAH = new URLRequest("http://www.arthavoc.com/");
artHavoc = new ArtHavocLink();
addChild(artHavoc);
artHavoc.addEventListener(MouseEvent.CLICK, arthavoc);
}
private function arthavoc(e:MouseEvent):void{
navigateToURL(urlAH, "_blank");
}
}
}//package
Section 2
//ArtHavocLink (ArtHavocLink)
package {
import flash.display.*;
public dynamic class ArtHavocLink extends SimpleButton {
}
}//package
Section 3
//Back (Back)
package {
import flash.display.*;
public dynamic class Back extends SimpleButton {
}
}//package
Section 4
//BGM (BGM)
package {
import flash.media.*;
public dynamic class BGM extends Sound {
}
}//package
Section 5
//Blank_Blob (Blank_Blob)
package {
import flash.display.*;
public dynamic class Blank_Blob extends MovieClip {
}
}//package
Section 6
//Blob (Blob)
package {
import flash.display.*;
import flash.geom.*;
public class Blob extends Sprite {
protected var _colorEdge:uint;
protected var _color:uint;
protected var _graphic:Blank_Blob;
protected var _radius:Number;
protected var _volume:int;// = 0
public function Blob(c:uint):void{
super();
_volume = 1;
_color = c;
if (_color == Goo.colorBonus){
_colorEdge = Goo.colorBonusEdge;
} else {
if (_color == Goo.colorMalus){
_colorEdge = Goo.colorMalusEdge;
};
};
init();
}
public function set colorEdge(n:uint):void{
_colorEdge = n;
}
public function get color():uint{
return (_color);
}
public function set color(n:uint):void{
_color = n;
if (_color == Goo.colorBonus){
_colorEdge = Goo.colorBonusEdge;
} else {
if (_color == Goo.colorMalus){
_colorEdge = Goo.colorMalusEdge;
};
};
}
public function get colorEdge():uint{
return (_colorEdge);
}
public function die():void{
Tools.destroyBlob(this);
}
public function get graphicRadius():int{
return ((_graphic.width / 2));
}
public function set target(p:Point):void{
_target.x = p.x;
_target.y = p.y;
}
protected function init():void{
_graphic = new Blank_Blob();
_graphic.transform.colorTransform = Tools.paint(_color);
addChild(graphic);
_radius = Tools.vTOr((_volume * Goo.unitVolume));
}
public function set volume(n:Number):void{
_volume = n;
_radius = Tools.vTOr((_volume * Goo.unitVolume));
}
public function get graphic():Blank_Blob{
return (_graphic);
}
public function get target():Point{
return (_target);
}
public function get volume():Number{
return (_volume);
}
public function get radius():Number{
return (_radius);
}
}
}//package
Section 7
//Blobber (Blobber)
package {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
public class Blobber extends MovieClip {
private var clickMe:ClickMe;
private var speed:int;
private var state:String;
private var SB:Boolean;
private var X:int;// = 0
private var clickMeTimer:Timer;
private var readyToWalk:Boolean;
private var oldState:String;
private var land:Boolean;// = true
private var blobula:Blobula;
public function Blobber(y:int, scoreBoard:Boolean=false){
super();
this.x = X;
this.y = y;
SB = scoreBoard;
init();
}
private function changeState(s:String):void{
switch (s){
case "walk":
blobula.gotoAndPlay("walk");
break;
case "jump":
readyToWalk = false;
blobula.gotoAndPlay("jump");
land = false;
break;
};
}
private function intoTheGame(e:MouseEvent):void{
Goo.itself.swapScreens(Goo.displayChild, 1);
}
private function init():void{
state = "jump";
readyToWalk = true;
speed = 4;
clickMeTimer = new Timer(2000, 1);
blobula = new Blobula();
blobula.x = 64;
addChild(blobula);
clickMe = new ClickMe();
clickMeTimer.addEventListener(TimerEvent.TIMER, displayClickMe);
blobula.addEventListener(MouseEvent.CLICK, intoTheGame);
clickMeTimer.reset();
clickMeTimer.start();
}
private function displayClickMe(e:TimerEvent):void{
addChild(clickMe);
clickMe.gotoAndPlay("clickme");
clickMe.y = (blobula.y - 128);
}
public function persistentOnEnterFrame():void{
oldState = state;
if (blobula.currentFrame == 24){
readyToWalk = true;
};
if ((((mouseX < (blobula.x + blobula.width))) || ((mouseX > (blobula.x - blobula.width))))){
state = "jump";
};
if (readyToWalk){
if (mouseX > (blobula.x + ((blobula.width / 2) + speed))){
state = "walk";
} else {
if (mouseX < (blobula.x - ((blobula.width / 2) + speed))){
state = "walk";
};
};
};
if (mouseX > (blobula.x + ((blobula.width / 4) + speed))){
blobula.scaleX = 1;
blobula.x = (blobula.x + speed);
} else {
if (mouseX < (blobula.x - ((blobula.width / 4) + speed))){
blobula.scaleX = -1;
blobula.x = (blobula.x - speed);
};
};
if (blobula.x < (blobula.width / 2)){
blobula.x = (blobula.width / 2);
};
if (!SB){
if (blobula.x > ((2 * Goo.center.x) - (blobula.width / 2))){
blobula.x = ((2 * Goo.center.x) - (blobula.width / 2));
};
} else {
if (blobula.x > ((2 * 308) - (blobula.width / 2))){
blobula.x = ((2 * 308) - (blobula.width / 2));
};
};
clickMe.x = blobula.x;
if (state != oldState){
changeState(state);
};
}
}
}//package
Section 8
//BlobGobbler_enthusiastic (BlobGobbler_enthusiastic)
package {
import flash.media.*;
public dynamic class BlobGobbler_enthusiastic extends Sound {
}
}//package
Section 9
//Blobula (Blobula)
package {
import flash.display.*;
public dynamic class Blobula extends MovieClip {
public function Blobula(){
addFrameScript(5, frame6, 24, frame25);
}
function frame6(){
gotoAndPlay("walk");
}
function frame25(){
gotoAndPlay("jump");
}
}
}//package
Section 10
//Buttons_Help (Buttons_Help)
package {
import flash.display.*;
public dynamic class Buttons_Help extends MovieClip {
public var you:Help_Circle;
public var bonus:MovieClip;
public var level:Help_Rectangle;
public var score:Help_Rectangle;
public var miniMap:Help_Circle;
public var scoreTimer:Help_Circle;
public var instant:Help_Rectangle;
public var back:Back;
public var malus:MovieClip;
}
}//package
Section 11
//Buttons_Menu (Buttons_Menu)
package {
import flash.display.*;
public dynamic class Buttons_Menu extends MovieClip {
public var title:Title;
public var back:Back;
}
}//package
Section 12
//Buttons_ScoreBoard (Buttons_ScoreBoard)
package {
import flash.display.*;
public dynamic class Buttons_ScoreBoard extends MovieClip {
public var previous:Previous;
public var next:Next;
public var namesANDscores:NamesAndScores;
public var title:Title;
}
}//package
Section 13
//Buttons_Submit (Buttons_Submit)
package {
import flash.display.*;
import flash.text.*;
public dynamic class Buttons_Submit extends MovieClip {
public var submit:Submit;
public var help:Help;
public var menu:Menu;
public var quit:Quit;
public var score:TextField;
public var retry:Retry;
public var signature:TextField;
}
}//package
Section 14
//Buttons_Title (Buttons_Title)
package {
import flash.display.*;
public dynamic class Buttons_Title extends MovieClip {
public var gameStart:GameStart;
}
}//package
Section 15
//Buttons_URLError (Buttons_URLError)
package {
import flash.display.*;
public dynamic class Buttons_URLError extends MovieClip {
public var reconnect:Reconnect;
public var title:Title;
}
}//package
Section 16
//ClickMe (ClickMe)
package {
import flash.display.*;
public dynamic class ClickMe extends MovieClip {
public function ClickMe(){
addFrameScript(0, frame1, 24, frame25);
}
function frame1(){
stop();
}
function frame25(){
gotoAndPlay("clickme");
}
}
}//package
Section 17
//ColorWheel (ColorWheel)
package {
public class ColorWheel {
public static var angle:Number;
public static var time:Number;
public function ColorWheel():void{
super();
angle = 0;
time = 1;
}
public function setSpeed(n:Number):void{
time = n;
}
public function reset():void{
angle = 0;
}
public static function colorWheel():uint{
var r:uint;
var g:uint;
var b:uint;
if (angle <= 0){
angle = (angle + (2 * Math.PI));
};
if (angle > (2 * Math.PI)){
angle = 0;
};
if (angle <= (Math.PI * (2 / 3))){
r = (0xFF * Math.cos((angle * (2 / 3))));
} else {
if (angle >= (Math.PI * (4 / 3))){
r = (0xFF * Math.cos(((angle - (Math.PI * 2)) * (2 / 3))));
} else {
r = 0;
};
};
if ((0 <= angle) <= (Math.PI * (4 / 3))){
g = (0xFF * Math.cos(((angle - (Math.PI * (2 / 3))) * (2 / 3))));
};
if (angle > (Math.PI * (4 / 3))){
g = 0;
};
if (((Math.PI * (2 / 3)) <= angle) <= (Math.PI * 2)){
b = (0xFF * Math.cos(((angle - (Math.PI * (4 / 3))) * (2 / 3))));
};
if (angle < (Math.PI * (2 / 3))){
b = 0;
};
var c:uint = (((r << 16) | (g << 8)) | b);
angle = (angle + (((2000 * Math.PI) / 24) * (1 / time)));
return (c);
}
}
}//package
Section 18
//Dial (Dial)
package {
import flash.display.*;
public dynamic class Dial extends MovieClip {
public var indicator:Dial_Indicator;
}
}//package
Section 19
//Dial_Indicator (Dial_Indicator)
package {
import flash.display.*;
public dynamic class Dial_Indicator extends MovieClip {
}
}//package
Section 20
//Die_1 (Die_1)
package {
import flash.media.*;
public dynamic class Die_1 extends Sound {
}
}//package
Section 21
//DJ (DJ)
package {
import flash.events.*;
import flash.media.*;
public class DJ {
public static var bgmMaxPosition:int;
public static var mixer:SoundMixer;
public static var drums:Drums;
public static var bgm:BGM;
public static var BGMTestChannel:SoundChannel;
public static var bgmPosition:int;
public static var ouch1:Ouch_1;
public static var defaultSoundTransform:SoundTransform;
public static var bgmChannel:SoundChannel;
public static var titleSound:BlobGobbler_enthusiastic;
public static var levelup:Level_Up;
public static var bgmTrack:Sound;
public static var max:Boolean;
public static var SFXTestChannel:SoundChannel;
public static var die1:Die_1;
public static var slurp1:Slurp_1;
public static var sfxChannel:SoundChannel;
public function DJ(){
super();
}
public static function defaultSettings():void{
defaultSoundTransform = new SoundTransform(0.5, 0);
SoundMixer.soundTransform = (sfxChannel.soundTransform = (bgmChannel.soundTransform = (SFXTestChannel.soundTransform = (BGMTestChannel.soundTransform = defaultSoundTransform))));
}
public static function hitItSFX(s:String):void{
sfxChannel.stop();
switch (s){
case "BONUS":
sfxChannel = slurp1.play(0, 1, sfxChannel.soundTransform);
break;
case "MALUS":
sfxChannel = ouch1.play(0, 1, sfxChannel.soundTransform);
break;
case "LEVEL":
sfxChannel = levelup.play(0, 1, sfxChannel.soundTransform);
break;
case "DIE":
sfxChannel = die1.play(0, 1, sfxChannel.soundTransform);
break;
case "TITLE":
sfxChannel = titleSound.play(0, 1, sfxChannel.soundTransform);
break;
};
}
public static function cutIt(all:Boolean=true):void{
trace("CUT!");
bgmPosition = (bgmChannel.position % bgmMaxPosition);
if (all){
SoundMixer.stopAll();
} else {
bgmChannel.stop();
};
}
public static function adjustVolume(v:Number, t:String):void{
var newSoundTransform:SoundTransform = new SoundTransform(v);
switch (t){
case "BGM":
bgmChannel.soundTransform = newSoundTransform;
break;
case "SFX":
sfxChannel.soundTransform = newSoundTransform;
break;
case "GLOBAL":
SoundMixer.soundTransform = newSoundTransform;
break;
};
trace(((v + " ") + newSoundTransform.volume));
SFXTestChannel.soundTransform = newSoundTransform;
BGMTestChannel.soundTransform = newSoundTransform;
}
public static function init():void{
sfxChannel = new SoundChannel();
bgmChannel = new SoundChannel();
SFXTestChannel = new SoundChannel();
BGMTestChannel = new SoundChannel();
bgm = new BGM();
drums = new Drums();
ouch1 = new Ouch_1();
slurp1 = new Slurp_1();
die1 = new Die_1();
levelup = new Level_Up();
titleSound = new BlobGobbler_enthusiastic();
bgmPosition = 0;
bgmMaxPosition = 0;
max = false;
trace("Initialize");
defaultSettings();
}
public static function repeat(e:Event):void{
trace("MOIIIOJIIOIIIHIHYUJYTJDJYTDJ");
max = true;
bgmMaxPosition = bgmPosition;
trace(bgmMaxPosition);
bgmChannel.removeEventListener(Event.SOUND_COMPLETE, repeat);
bgmChannel = bgmTrack.play(0, int.MAX_VALUE);
}
public static function hitItBGM(s:String, beginning:Boolean=false):void{
trace("HIT IT!");
if (beginning){
max = false;
bgmPosition = 0;
};
switch (s){
case "BGM":
bgmTrack = bgm;
break;
case "DRUMS":
bgmTrack = drums;
break;
};
if (!max){
bgmMaxPosition = bgmChannel.position;
};
bgmChannel = bgmTrack.play(bgmPosition, 1);
bgmChannel.addEventListener(Event.SOUND_COMPLETE, repeat);
}
}
}//package
Section 22
//Drums (Drums)
package {
import flash.media.*;
public dynamic class Drums extends Sound {
}
}//package
Section 23
//Eyes (Eyes)
package {
import flash.display.*;
public dynamic class Eyes extends MovieClip {
public function Eyes(){
addFrameScript(23, frame24);
}
function frame24(){
gotoAndPlay("blink");
}
}
}//package
Section 24
//Game (Game)
package {
import flash.display.*;
import flash.text.*;
public dynamic class Game extends MovieClip {
public var menu:Menu;
public var times:TextField;
public var level:TextField;
public var hint:TextField;
public var score:TextField;
public var instant:TextField;
}
}//package
Section 25
//GameStart (GameStart)
package {
import flash.display.*;
public dynamic class GameStart extends SimpleButton {
}
}//package
Section 26
//Goo (Goo)
package {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.system.*;
public dynamic class Goo extends MovieClip {
private var game:GooGame;
private var scoreBoard:ScoreBoard;
private var opening:Opening;
private var submitScore:SubmitScore;
private var title:GooTitle;
public static const quantum:uint = 2;
public static const outline:uint = 4;
public static const center:Point = new Point(0x0100, 0x0100);
public static const worldSize:Number = 0x0400;
public static var colorHero:uint;
public static var targetWorldRatio:Number;
public static var addRateSeedGood:int = 0;
public static var colorScoreVisual:uint;
public static var maxRateEvil:int = 100;
public static var apparentWorldSize:Number;
public static var easeDamper:Number = (maxSpeed / easeRate);
public static var pidgeonSWF:Object;
public static var maxRateSeedEvil:int = 100;
public static var paused:Boolean = false;
public static var pidgeonTries:int = 0;
public static var carrierPidgeon:String = new String("http://www.arthavoc.com/Goo/CarrierPidgeon.swf");
public static var buffer:Number = 32;
public static var maxRateGood:int = 1800;
public static var maxSpeed:Number = 32;
public static var mergeEaseRate:Number = 0.125;
public static var worldProportionDelta:Number;
public static var overlay:Sprite;
public static var colorMalus:uint;
public static var addRateEvil:int = 2300;
public static var canvas:Sprite;
public static var maxRateSeedGood:int = 2400;
public static var worldMinMoveRadius:Number;
public static var heroMoveRadius:Number;
public static var colorBonusEdge:uint;
public static var worldWiggle:Number = worldSizeDelta;
public static var displayChild:Screen;
public static var colorBonus:uint;
public static var addRateGood:int = 0;
public static var icing:Sprite;
public static var rateScore:int = 3200;
public static var rateEvil:int = (maxRateEvil + addRateEvil);
public static var maxTries:int = 32;
public static var worldRatio:Number;
public static var topHundredScores:Array = new Array(100);
public static var options:Options;
public static var pidgeonMessage:Array;
public static var visibleRadius:Number = center.x;
public static var rateSeedEvil:int = (maxRateSeedEvil + addRateSeedEvil);
public static var dj:DJ;
public static var protoBlob:Number = 8;
public static var info:Info;
public static var colorMalusEdge:uint;
public static var pidgeonRecipient:String = new String("http://www.arthavoc.com/Goo/scoreGoo.php");
public static var rateGood:int = (maxRateGood + addRateGood);
public static var unitVolume:Number = Tools.rTOv(protoBlob);
public static var worldSizeDelta:Number = (worldSize - center.x);
public static var rateSeedGood:int = (maxRateSeedGood + addRateSeedGood);
public static var worldMaxMoveRadius:Number;
public static var urlError:URLErrorMessage;
public static var addRateSeedEvil:int = 3500;
public static var easeRate:Number = 0.167;
public static var itself:Goo;
public static var pidgeonMaxTries:int = 5;
public function Goo():void{
super();
Security.allowInsecureDomain(carrierPidgeon);
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
itself = this;
stage.focus = this;
run();
}
private function onKeyDown(e:KeyboardEvent):void{
displayChild.onKeyDown(e);
}
private function onEnterFrame(e:Event):void{
graphics.clear();
currentScreen(displayChild);
}
private function currentScreen(s:Screen):void{
if (!paused){
s.onEnterFrame();
};
if ((((((s == opening)) || ((s == submitScore)))) || ((((s == scoreBoard)) && (!((s.blobber == null))))))){
s.blobber.persistentOnEnterFrame();
};
s.persistentOnEnterFrame();
info.persistentOnEnterFrame();
options.persistentOnEnterFrame();
}
private function dispatchToScoreBoard(e:Event):void{
if ((((displayChild == ScoreBoard.itself)) && (!((ScoreBoard.itself == null))))){
ScoreBoard.itself.dispatchEvent(new Event("TOP_SCORE_UPDATE"));
} else {
return;
};
}
private function run():void{
MochiAd.showPreGameAd({clip:root, id:"998e27bbe769002b", res:"512x512", background:0xFFFF, color:153, outline:0xFFFFFF, no_bg:false});
itself.addEventListener("TOP_SCORE_READY", dispatchToScoreBoard);
pidgeonMessage = new Array(new String("VIEW"), _slot1.topHundredScores.length, new Array(0, "ANONYMOUS"));
DJ.init();
canvas = new Sprite();
icing = new Sprite();
addChildAt(canvas, 0);
addChild(icing);
overlay = new Sprite();
addChild(overlay);
defaultOptions();
info = new Info();
options = new Options();
urlError = new URLErrorMessage();
icing.graphics.lineStyle(1, 0xFFFFFF);
ColorWheel.angle = 0;
ColorWheel.time = 500;
colorHero = 0xFF;
colorBonus = 153;
colorMalus = 0xBB0000;
colorBonusEdge = 0xFFFF;
colorMalusEdge = 0xFF0000;
colorScoreVisual = 153;
stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown);
itself.addEventListener("MOCHI", adLoaded);
}
public function swapScreens(oldScreen:Screen, newScreen:int):void{
oldScreen.cleanUp();
cleanUpScreen(oldScreen);
displayScreen(newScreen);
}
public function getColor(s:String):uint{
switch (s){
case "colorBonus":
return (colorBonus);
case "colorMalus":
return (colorMalus);
default:
return (0);
};
}
public function displayScreen(c:int):void{
var token:Screen;
switch (c){
case 0:
opening = new Opening();
DJ.hitItBGM("DRUMS", true);
token = opening;
break;
case 1:
title = new GooTitle();
DJ.cutIt();
token = title;
break;
case 2:
game = new GooGame();
token = game;
DJ.hitItBGM("BGM", true);
GooGame.begin();
break;
case 3:
submitScore = new SubmitScore();
DJ.cutIt(false);
token = submitScore;
break;
case 4:
scoreBoard = new ScoreBoard();
DJ.cutIt();
token = scoreBoard;
break;
default:
return;
};
displayChild = token;
canvas.addChildAt(token, 0);
stage.focus = token;
}
private function adLoaded(e:Event):void{
trace("MOOKA LOOKA!");
Tools.releasePidgeon(carrierPidgeon);
addEventListener(Event.ENTER_FRAME, onEnterFrame);
displayScreen(0);
}
public function cleanUpScreen(s:Screen):void{
canvas.removeChild(s);
}
public function cleanUp(o:Object):void{
Tools.removeAllChildren(o);
}
public function defaultOptions():void{
}
public static function displayInfoErrorOptions(s:String, undisplay:Boolean=false):void{
var child:Screen;
if (s == "INFO"){
child = info;
Info.caller = displayChild;
} else {
if (s == "OPTIONS"){
child = options;
Options.caller = displayChild;
options.setDials();
} else {
if (s == "ERROR"){
child = urlError;
Options.caller = displayChild;
} else {
return;
};
};
};
if (!undisplay){
DJ.cutIt();
overlay.addChild(child);
paused = true;
} else {
if (undisplay){
overlay.removeChild(child);
paused = false;
} else {
return;
};
};
}
public static function preparePidgeon(action:String, ns:Array=null):void{
_slot1.pidgeonMessage = new Array(new String(action), _slot1.topHundredScores.length, ns);
Tools.releasePidgeon(_slot1.carrierPidgeon);
}
}
}//package
Section 27
//GooGame (GooGame)
package {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.text.*;
import flash.utils.*;
import flash.ui.*;
public class GooGame extends Screen {
private var level:int;
private var timeThen:int;
private var occlusion:Sprite;
private var heroM:Point;
private var heroP:Point;
private var lastPoint:Point;
private var gameM:Point;
private var miniZone:Sprite;
private var gooM:Point;
private var AH:ArtHavoc;
private var scoreFormat:TextFormat;
private var background:Game;
private var worldGraphicProportion:Number;
private var translation:Point;
private var scoreVisualization:Sprite;
private var miniBitmapData:BitmapData;
private var downDial:Boolean;// = false
private var viewCenterP:Point;
private var timeRatio:Number;
private var volumeKnob:Knob;
private var miniRadius:Number;// = 44
private var timeNow:int;
private var newPoint:Point;
private var zoneRadius:Number;
private var miniBitmap:Bitmap;
private var timeDelta:int;// = 0
private var cosmosP:Point;
private var miniZonePosition:Point;
private var f:Number;
private var miniOcclusion:Sprite;
private var miniMatrix:Matrix;
private var worldP:Point;
public static var mergingBlobs:Array;
public static var scoreBase:uint;
public static var miniMap:Sprite;
public static var timerAddBonusSeed:Timer;
public static var world:Sprite;
public static var score:uint;
public static var mapProportion:Number;
public static var scoreInstantaneous:uint;
public static var zero:Point;
public static var cosmos:Sprite;
public static var blobLayer:Sprite;
public static var goodBlobs:Array;
public static var timerAddMalus:Timer;
public static var highlights:Sprite;
public static var miniMapCenter:Point;
public static var evilBlobs:Array;
public static var highlightsBMD:BitmapData;
public static var highlightsBM:Bitmap;
public static var timerAddMalusSeed:Timer;
public static var timerScore:Timer;
public static var multipliers:Array;
public static var center:Point;
public static var edges:Sprite;
public static var worldPosition:Point;
public static var largest:Number;
public static var timerAddBonus:Timer;
public static var emergingBlobs:Array;
public static var highlightsMatrix:Matrix;
public static var zeroDelta:Point;
public static var blobs:Array;
public static var itself:GooGame;
public static var hero:Hero;
public static var worldGraphic:World;
public function GooGame():void{
Goo.tracer = (Goo.tracer + "MB");
super();
itself = this;
init();
}
private function pause():void{
trace("PAUSE! 222222222222222222222222");
timerScore.stop();
timerAddBonusSeed.stop();
timerAddMalusSeed.stop();
timerAddBonus.stop();
timerAddMalus.stop();
timerScore.stop();
Goo.paused = true;
}
public function miniZoneDraw():void{
miniZone.graphics.clear();
zoneRadius = ((Goo.center.x * miniRadius) / Goo.apparentWorldSize);
if (zoneRadius > miniRadius){
zoneRadius = miniRadius;
};
miniZone.graphics.lineStyle(2, 0xFFFFFF);
miniZone.graphics.drawCircle(0, 0, int(zoneRadius));
}
public function newTimers():void{
timerAddBonusSeed.delay = Goo.rateSeedGood;
timerAddMalusSeed.delay = Goo.rateSeedEvil;
timerAddBonus.delay = Goo.rateGood;
timerAddMalus.delay = Goo.rateEvil;
}
private function init():void{
Goo.maxSpeed = (Goo.worldSize / 32);
Goo.apparentWorldSize = Goo.worldSize;
Goo.worldRatio = (Goo.apparentWorldSize / Goo.worldSize);
Goo.targetWorldRatio = Goo.worldRatio;
Goo.worldProportionDelta = (Goo.worldSizeDelta / Goo.worldSizeDelta);
Goo.worldMaxMoveRadius = 108;
Goo.worldMinMoveRadius = 32;
Goo.heroMoveRadius = (Goo.center.x - Hero.initialRadius);
worldPosition = new Point(0, 0);
level = 1;
score = 0;
scoreBase = 10;
multipliers = new Array();
blobs = new Array();
mergingBlobs = new Array();
emergingBlobs = new Array();
evilBlobs = new Array();
goodBlobs = new Array();
timerScore = new Timer(Goo.rateScore, 0);
timerAddBonusSeed = new Timer(Goo.rateSeedGood, 0);
timerAddMalusSeed = new Timer(Goo.rateSeedEvil, 0);
timerAddBonus = new Timer(Goo.rateGood, 0);
timerAddMalus = new Timer(Goo.rateEvil, 0);
background = new Game();
Goo.icing.addChild(background);
AH = new ArtHavoc();
AH.x = 44;
AH.y = 468;
background.addChild(AH);
cosmos = new Sprite();
addChild(cosmos);
world = new Sprite();
cosmos.addChild(world);
worldGraphic = new World();
worldGraphicProportion = (Goo.worldSize / Goo.center.x);
worldGraphic.x = -(Goo.apparentWorldSize);
worldGraphic.y = -(Goo.apparentWorldSize);
worldGraphic.scaleX = worldGraphicProportion;
worldGraphic.scaleY = worldGraphicProportion;
world.addChild(worldGraphic);
edges = new Sprite();
highlights = new Sprite();
blobLayer = new Sprite();
highlightsMatrix = new Matrix();
highlightsBMD = new BitmapData((Goo.worldSize * 2), (Goo.worldSize * 2), true, 0);
highlightsBM = new Bitmap(highlightsBMD);
highlightsBM.x = -(Goo.apparentWorldSize);
highlightsBM.y = -(Goo.apparentWorldSize);
world.addChild(edges);
world.addChild(blobLayer);
world.addChild(highlightsBM);
highlightsBMD.setPixel(0, 0, 0xFFFFFF);
center = new Point((itself.width / 2), (itself.height / 2));
center.x = Goo.worldSize;
center.y = Goo.worldSize;
zero = new Point((Goo.center.x - Goo.apparentWorldSize), (Goo.center.y - Goo.apparentWorldSize));
zeroDelta = new Point(zero.x, zero.y);
scoreVisualization = new Sprite();
scoreVisualization.x = 38;
scoreVisualization.y = 60;
Goo.icing.addChild(scoreVisualization);
mapProportion = (44 / Goo.apparentWorldSize);
miniMap = new Sprite();
miniMap.x = 468;
miniMap.y = 44;
miniMapCenter = new Point((miniMap.width / 2), (miniMap.height / 2));
miniZone = new Sprite();
miniZoneDraw();
Goo.icing.addChildAt(miniMap, 0);
miniMap.addChild(miniZone);
miniMatrix = new Matrix();
miniMatrix.scale(mapProportion, mapProportion);
miniMatrix.tx = (miniMatrix.ty = miniRadius);
miniBitmapData = new BitmapData(88, 88, true, 0);
miniBitmap = new Bitmap(miniBitmapData);
miniBitmap.x = -(miniRadius);
miniBitmap.y = -(miniRadius);
miniMap.addChildAt(miniBitmap, 0);
hero = new Hero();
world.addChild(hero);
hero.x = (hero.y = (world.width / 2));
occlusion = new Sprite();
Tools.fullCircle(Goo.center.x, Goo.center.y, Goo.center.x, 0, occlusion);
miniOcclusion = new Sprite();
Tools.fullCircle(miniMap.x, miniMap.y, miniRadius, 0, miniOcclusion);
Goo.canvas.mask = occlusion;
miniMap.mask = miniOcclusion;
translation = new Point(0, 0);
scoreFormat = new TextFormat();
scoreFormat.size = 12;
scoreFormat.bold = true;
scoreFormat.font = "Lithos Pro Regular";
background.score.setTextFormat(scoreFormat);
background.instant.selectable = false;
background.level.selectable = false;
background.times.selectable = false;
background.instant.text = 0;
background.level.text = level;
background.times.text = "x";
multipliers[0] = 1;
multipliers[2] = 1;
timeThen = getTimer();
background.menu.addEventListener(MouseEvent.CLICK, menu);
timerScore.addEventListener(TimerEvent.TIMER, onTimer_Score);
timerAddBonusSeed.addEventListener(TimerEvent.TIMER, onTimer_AddBonusSeed);
timerAddMalusSeed.addEventListener(TimerEvent.TIMER, onTimer_AddMalusSeed);
timerAddBonus.addEventListener(TimerEvent.TIMER, onTimer_AddBonus);
timerAddMalus.addEventListener(TimerEvent.TIMER, onTimer_AddMalus);
}
private function onTimer_AddBonus(e:TimerEvent):void{
var proliferate:Boolean = new Boolean(false);
if (goodBlobs.length == 0){
proliferate = true;
};
Tools.createBlob(Goo.colorBonus, proliferate);
}
public function worldPositionDelta():Point{
return (new Point((Goo.worldWiggle * (-(moveM.x) / Goo.worldMoveRadius)), (Goo.worldWiggle * (-(moveM.y) / Goo.worldMoveRadius))));
}
public function gameOver():void{
Goo.itself.swapScreens(this, 3);
}
private function onTimer_AddBonusSeed(e:TimerEvent):void{
Tools.createBlob(Goo.colorBonus);
}
private function onTimer_Score(e:TimerEvent):void{
background.instant.text = scoreInstantaneous;
score = (score + scoreInstantaneous);
timeThen = getTimer();
}
private function displayMenu():void{
pause();
Goo.displayInfoErrorOptions("OPTIONS");
}
override public function onKeyDown(e:KeyboardEvent):void{
switch (e.keyCode){
case Keyboard.SPACE:
if (!Goo.paused){
displayMenu();
} else {
unpause();
};
break;
default:
return;
};
}
override public function onEnterFrame():void{
Goo.tracer = ((((((((((((((("fps: " + Math.round((1000 / (getTimer() - f)))) + " b:") + blobs.length) + " max:") + (((blobs.length * blobs.length) - blobs.length) / 2)) + " - actual:") + Goo.counter) + " = ") + ((((blobs.length * blobs.length) - blobs.length) / 2) - Goo.counter)) + " % ") + Math.round(((Goo.counter * 100) / (((blobs.length * blobs.length) - blobs.length) / 2)))) + " Hero:") + hero.volume) + " max:") + Hero.maxVolume);
f = getTimer();
gameM = new Point(mouseX, mouseY);
gooM = new Point((Goo.itself.mouseX - Goo.center.x), (Goo.itself.mouseY - Goo.center.y));
moveM = Tools.inCircle(gooM, Goo.worldMaxMoveRadius);
heroM = Tools.inCircle(gooM, Goo.heroMoveRadius);
Goo.worldRatio = (Goo.worldRatio + ((Goo.targetWorldRatio - Goo.worldRatio) * Goo.easeRate));
if (Math.abs((Goo.targetWorldRatio - Goo.worldRatio)) < (1 / Goo.worldSize)){
Goo.worldRatio = Goo.targetWorldRatio;
};
Goo.visibleRadius = (Goo.center.x / Goo.worldRatio);
resetHeroMoveRadius();
cosmos.scaleX = (cosmos.scaleY = Goo.worldRatio);
translation.x = (translation.x + velocity().x);
translation.y = (translation.y + velocity().y);
translation = Tools.inCircle(translation, (Goo.worldSize - Goo.visibleRadius));
cosmos.x = (heroM.x + Goo.center.x);
cosmos.y = (heroM.y + Goo.center.y);
viewCenterP = new Point((cosmos.x - heroM.x), (cosmos.x - heroM.x));
heroP = Tools.inCircle(new Point(((heroM.x * (1 / Goo.worldRatio)) + translation.x), ((heroM.y * (1 / Goo.worldRatio)) + translation.y)), (Goo.worldSize - hero.radius));
hero.x = heroP.x;
hero.y = heroP.y;
worldP = Tools.inCircle(new Point(((((zero.x + Goo.worldSize) - cosmos.x) * (1 / Goo.worldRatio)) - (translation.x * 1)), ((((zero.y + Goo.worldSize) - cosmos.y) * (1 / Goo.worldRatio)) - (translation.y * 1))), Goo.worldSize);
world.x = worldP.x;
world.y = worldP.y;
miniZonePosition = Tools.inCircle(new Point((miniMapCenter.x - (world.x * (miniRadius / Goo.worldSize))), (miniMapCenter.y - (world.y * (miniRadius / Goo.worldSize)))), (miniRadius - zoneRadius));
miniZone.x = miniZonePosition.x;
miniZone.y = miniZonePosition.y;
edges.graphics.clear();
var i:int;
while (i < blobs.length) {
Tools.grow(blobs[i]);
i++;
};
if (blobs != null){
Tools.checkBlobs(blobs);
};
if (Tools.checkHero(blobs)){
return;
};
miniBitmapData.draw(world, miniMatrix);
multipliers[1] = sizeMultiplier();
scoreInstantaneous = ((scoreBase * (multipliers[0] + multipliers[1])) * multipliers[2]);
timeNow = getTimer();
timeDelta = (timeNow - timeThen);
timeRatio = (timeDelta / Goo.rateScore);
if (timeRatio > 1){
timeRatio = 1;
};
background.score.text = ("" + score);
Tools.fullArc(scoreVisualization, miniMapCenter.x, miniMapCenter.y, (36 * (hero.radius / Hero.apparentWinRadius)), -((Math.PI / 2)), ((Math.PI * 2) * timeRatio), Goo.colorScoreVisual);
hero.color = Goo.colorHero;
hero.redrawHero();
}
override public function cleanUp():void{
background.score.text = "";
scoreVisualization.graphics.clear();
timerAddBonusSeed.reset();
timerAddMalusSeed.reset();
timerAddBonus.reset();
timerAddMalus.reset();
timerScore.reset();
highlightsBMD.dispose();
Goo.canvas.mask = null;
miniBitmapData.dispose();
miniZone.graphics.clear();
Tools.removeAllChildren(this);
Tools.removeAllChildren(Goo.icing);
background.menu.removeEventListener(MouseEvent.CLICK, menu);
timerScore.removeEventListener(TimerEvent.TIMER, onTimer_Score);
timerAddBonusSeed.removeEventListener(TimerEvent.TIMER, onTimer_AddBonusSeed);
timerAddMalusSeed.removeEventListener(TimerEvent.TIMER, onTimer_AddMalusSeed);
timerAddBonus.removeEventListener(TimerEvent.TIMER, onTimer_AddBonus);
timerAddMalus.removeEventListener(TimerEvent.TIMER, onTimer_AddMalus);
}
private function destroyBlob(b:Blob):void{
Tools.destroyBlob(b);
blobs = Tools.combineArrays(evilBlobs, goodBlobs);
}
private function onTimer_AddMalus(e:TimerEvent):void{
var proliferate:Boolean = new Boolean(false);
if (evilBlobs.length == 0){
proliferate = true;
};
Tools.createBlob(Goo.colorMalus, proliferate);
}
public function velocity():Point{
return (Tools.distanceBetweenCirclesPoint(moveM, Goo.worldMinMoveRadius, Goo.worldMaxMoveRadius, Goo.maxSpeed));
}
private function menu(e:Event):void{
displayMenu();
}
public function nextLevel():void{
var ratio:Number = (1 - (level / 10));
if (ratio < 0){
ratio = 0;
};
hero.volume = Hero.initialVolume;
var _local2 = multipliers;
var _local3 = 2;
var _local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
level++;
if (level >= Goo.maxLevel){
level = Goo.maxLevel;
};
Goo.rateSeedEvil = (Goo.maxRateSeedEvil + (Goo.addRateSeedEvil * ratio));
Goo.rateSeedGood = Goo.maxRateSeedGood;
Goo.rateEvil = (Goo.maxRateEvil + (Goo.addRateEvil * ratio));
Goo.rateGood = Goo.maxRateGood;
newTimers();
trace(((((((((((((("Good: " + Goo.rateSeedGood) + " + ") + Goo.rateGood) + " = ") + Goo.rateSeedGood) + Goo.rateGood) + " Evil: ") + Goo.rateSeedEvil) + " + ") + Goo.rateEvil) + " = ") + Goo.rateSeedEvil) + Goo.rateEvil));
background.level.text = level;
Tools.resizeWorld();
DJ.hitItSFX("LEVEL");
}
override public function persistentOnEnterFrame():void{
}
public function unpause():void{
timeThen = (getTimer() - timeDelta);
Goo.paused = false;
Goo.displayInfoErrorOptions("OPTIONS", true);
stage.focus = itself;
DJ.hitItBGM("BGM");
begin();
trace("4444444444444444444");
}
private function onTimer_AddMalusSeed(e:TimerEvent):void{
Tools.createBlob(Goo.colorMalus);
}
public static function resetHeroMoveRadius():void{
Goo.heroMoveRadius = (Goo.center.x - (hero.radius * Goo.worldRatio));
}
public static function begin():void{
f = getTimer();
DJ.hitItSFX("TITLE");
timerScore.start();
timerAddBonusSeed.start();
timerAddMalusSeed.start();
timerAddBonus.start();
timerAddMalus.start();
}
public static function sizeMultiplier():uint{
var multiplier:uint;
multiplier = Math.floor((hero.radius / Hero.initialRadius));
return (multiplier);
}
}
}//package
Section 28
//GooTitle (GooTitle)
package {
import flash.events.*;
public class GooTitle extends Screen {
private var startGame:Buttons_Title;
public static var itself:GooTitle;
public function GooTitle():void{
Goo.tracer = (Goo.tracer + "NI");
super();
itself = this;
init();
}
private function gameStart(e:MouseEvent):void{
trace("START YOUR ENGINES!");
Goo.itself.swapScreens(this, 2);
}
private function init():void{
Goo.errorMessage = "";
startGame = new Buttons_Title();
addChild(startGame);
startGame.gameStart.addEventListener(MouseEvent.CLICK, gameStart);
}
override public function onEnterFrame():void{
}
override public function cleanUp():void{
startGame.gameStart.removeEventListener(MouseEvent.CLICK, gameStart);
removeChild(startGame);
}
}
}//package
Section 29
//Help (Help)
package {
import flash.display.*;
public dynamic class Help extends SimpleButton {
}
}//package
Section 30
//Help_Circle (Help_Circle)
package {
import flash.display.*;
public dynamic class Help_Circle extends MovieClip {
}
}//package
Section 31
//Help_Rectangle (Help_Rectangle)
package {
import flash.display.*;
public dynamic class Help_Rectangle extends MovieClip {
}
}//package
Section 32
//Hero (Hero)
package {
public class Hero extends Blob {
public static const apparentMaxRadius:Number = 170;
public static const initialRadius:Number = Tools.vTOr(Tools.rTOv(apparentMinRadius));
public static const apparentMinRadius:Number = (Goo.center.x / 8);
public static const maxVolume:Number = ((Tools.rTOv(apparentWinRadius) / Goo.unitVolume) >> 0);
public static const apparentWinRadius:Number = 204;
public static const maxRadius:Number = Tools.vTOr(Tools.rTOv(apparentMaxRadius));
public static const initialVolume:Number = (Tools.rTOv(apparentMinRadius) / Goo.unitVolume);
public static var itself:Hero;
public function Hero():void{
super(Goo.colorHero);
itself = this;
init();
}
override protected function init():void{
_graphic = new Blank_Blob();
addChild(graphic);
_volume = initialVolume;
_radius = Tools.vTOr((_volume * Goo.unitVolume));
}
public function redrawHero():void{
_graphic.transform.colorTransform = Tools.paint(_color);
Tools.drawBlob(itself);
}
}
}//package
Section 33
//HighScores (HighScores)
package {
import flash.display.*;
public dynamic class HighScores extends SimpleButton {
}
}//package
Section 34
//Info (Info)
package {
import flash.events.*;
import flash.text.*;
public class Info extends Screen {
private var help:Buttons_Help;
private var textFormat:TextFormat;
private var oldX:int;
private var oldY:int;
private var textDefault:String;
private var textHelp:TextField;
private var AH:ArtHavoc;
private var flip:int;// = -1
private var newX:int;
private var newY:int;
public static var caller:Screen;
public function Info(){
newX = Goo.center.x;
newY = Goo.center.y;
oldX = Goo.center.x;
oldY = Goo.center.y;
super();
init();
}
private function init():void{
help = new Buttons_Help();
addChild(help);
AH = new ArtHavoc();
AH.x = 44;
AH.y = 468;
help.addChild(AH);
textDefault = "If you shrink to nothing your game ends.\nPress the SPACEBAR to pause.";
textHelp = new TextField();
textFormat = new TextFormat();
textFormat.size = 16;
textFormat.font = "Myriad Pro";
textHelp.width = 148;
textHelp.selectable = false;
textHelp.text = textDefault;
textHelp.background = true;
textHelp.border = true;
textHelp.borderColor = 0xFFFF;
textHelp.backgroundColor = 153;
textHelp.textColor = 0xFFFFFF;
textHelp.wordWrap = true;
textHelp.autoSize = TextFieldAutoSize.CENTER;
textHelp.setTextFormat(textFormat);
addChild(textHelp);
help.back.addEventListener(MouseEvent.CLICK, back);
help.back.addEventListener(MouseEvent.ROLL_OVER, displayHelpText);
help.back.addEventListener(MouseEvent.ROLL_OUT, undisplayHelpText);
help.you.addEventListener(MouseEvent.ROLL_OVER, displayHelpText);
help.you.addEventListener(MouseEvent.ROLL_OUT, undisplayHelpText);
help.malus.addEventListener(MouseEvent.ROLL_OVER, displayHelpText);
help.malus.addEventListener(MouseEvent.ROLL_OUT, undisplayHelpText);
help.bonus.addEventListener(MouseEvent.ROLL_OVER, displayHelpText);
help.bonus.addEventListener(MouseEvent.ROLL_OUT, undisplayHelpText);
help.score.addEventListener(MouseEvent.ROLL_OVER, displayHelpText);
help.score.addEventListener(MouseEvent.ROLL_OUT, undisplayHelpText);
help.level.addEventListener(MouseEvent.ROLL_OVER, displayHelpText);
help.level.addEventListener(MouseEvent.ROLL_OUT, undisplayHelpText);
help.instant.addEventListener(MouseEvent.ROLL_OVER, displayHelpText);
help.instant.addEventListener(MouseEvent.ROLL_OUT, undisplayHelpText);
help.scoreTimer.addEventListener(MouseEvent.ROLL_OVER, displayHelpText);
help.scoreTimer.addEventListener(MouseEvent.ROLL_OUT, undisplayHelpText);
help.miniMap.addEventListener(MouseEvent.ROLL_OVER, displayHelpText);
help.miniMap.addEventListener(MouseEvent.ROLL_OUT, undisplayHelpText);
AH.addEventListener(MouseEvent.ROLL_OVER, displayHelpText);
AH.addEventListener(MouseEvent.ROLL_OUT, undisplayHelpText);
}
override public function persistentOnEnterFrame():void{
if (mouseX < Goo.center.x){
flip = 12;
} else {
flip = -((textHelp.width + 6));
};
newX = (mouseX + flip);
if (mouseY < Goo.center.y){
flip = 24;
} else {
flip = -((textHelp.height + 6));
};
newY = (mouseY + flip);
textHelp.x = (oldX + ((newX - oldX) * 0.666));
textHelp.y = (oldY + ((newY - oldY) * 0.666));
oldX = textHelp.x;
oldY = textHelp.y;
}
private function back(e:Event):void{
Goo.displayInfoErrorOptions("INFO", true);
}
private function undisplayHelpText(e:MouseEvent):void{
textHelp.text = textDefault;
}
private function displayHelpText(e:MouseEvent):void{
var newText:String = new String();
switch (e.target){
case help.back:
newText = "Back to the game!";
break;
case help.you:
newText = "This is you.";
break;
case help.malus:
newText = "These make you smaller.";
break;
case help.bonus:
newText = "These make you bigger.";
break;
case help.score:
newText = "Your score.";
break;
case help.scoreTimer:
newText = "When this fills up you get points and its size shows your progress.";
break;
case help.instant:
newText = "This shows your instantaneous score.";
break;
case help.level:
newText = "This shows your level and score multiplier.";
break;
case help.miniMap:
newText = "This shows you where you are and how far you can see.";
break;
case AH:
newText = "Link to the awesome website ArtHavoc.";
break;
};
textHelp.text = newText;
textHelp.setTextFormat(textFormat);
}
}
}//package
Section 35
//Intro (Intro)
package {
import flash.display.*;
public dynamic class Intro extends MovieClip {
public var help:Help;
public var menu:Menu;
public var highScores:HighScores;
}
}//package
Section 36
//Knob (Knob)
package {
import flash.events.*;
import flash.display.*;
import flash.media.*;
public class Knob extends Sprite {
private var _global:Boolean;// = false
private var dialAngle:Number;// = 0
private var _channel:SoundChannel;
private var _downDial:Boolean;// = false
private var offset:Number;
private var _type:String;
private var angle:Number;
private var lastAngle:Number;// = 0
private var dial:Dial;
private var _value:Number;
private var angle2:Number;
public function Knob(global:Boolean, c:String=null){
offset = (-(Math.PI) * (5 / 16));
super();
if (!global){
setChannel(c);
} else {
_type = "GLOBAL";
_global = true;
};
dial = new Dial();
dial.x = 36;
dial.y = 51;
dial.indicator.x = (Math.cos((dialAngle + offset)) * 24);
dial.indicator.y = (Math.sin(((dialAngle + offset) + (Math.PI / 12))) * 24);
addChild(dial);
}
public function unsetDial(e:MouseEvent):void{
switch (_type){
case "SFX":
trace("oh yeah1");
DJ.SFXTestChannel = DJ.titleSound.play(0, int.MAX_VALUE);
break;
case "BGM":
trace("oh yeah2");
DJ.BGMTestChannel = DJ.bgm.play(0, int.MAX_VALUE);
break;
case "GLOBAL":
trace("oh yeah3");
DJ.SFXTestChannel = DJ.bgm.play(0, int.MAX_VALUE, DJ.sfxChannel.soundTransform);
DJ.BGMTestChannel = DJ.titleSound.play(0, int.MAX_VALUE, DJ.bgmChannel.soundTransform);
break;
};
_downDial = true;
}
public function setChannel(c:String):void{
switch (c){
case "BGM":
trace("bgm");
_type = "BGM";
_channel = DJ.bgmChannel;
trace((_channel == DJ.bgmChannel));
break;
case "SFX":
trace("sfx");
_type = "SFX";
_channel = DJ.sfxChannel;
trace((_channel == DJ.sfxChannel));
break;
};
}
public function listen(e:MouseEvent):void{
addEventListener(MouseEvent.MOUSE_DOWN, unsetDial);
addEventListener(MouseEvent.MOUSE_UP, setDial);
}
public function setDial(e:MouseEvent):void{
trace("HEEBIE JEEBIE");
DJ.SFXTestChannel.stop();
DJ.BGMTestChannel.stop();
_downDial = false;
}
public function get downDial():Number{
return (_downDial);
}
public function adjustDial():void{
angle = Math.atan2(dial.mouseY, dial.mouseX);
angle2 = Math.atan2(Math.sin((angle - offset)), Math.cos((angle - offset)));
if (angle2 >= (Math.PI * (13 / 16))){
angle2 = (Math.PI * (13 / 16));
};
if (angle2 <= (Math.PI * (-13 / 16))){
angle2 = (Math.PI * (-13 / 16));
};
dialAngle = (lastAngle + ((angle2 - lastAngle) * 0.333));
_value = ((dialAngle + (Math.PI * (13 / 16))) / (Math.PI * (13 / 8)));
DJ.adjustVolume(_value, _type);
dial.indicator.x = (Math.cos((dialAngle + offset)) * 24);
dial.indicator.y = (Math.sin(((dialAngle + offset) + (Math.PI / 12))) * 24);
lastAngle = dialAngle;
}
public function unlisten(e:MouseEvent):void{
_downDial = false;
removeEventListener(MouseEvent.MOUSE_DOWN, unsetDial);
removeEventListener(MouseEvent.MOUSE_UP, setDial);
}
public function get value():Number{
return (_value);
}
public function set volume(v:Number):void{
dialAngle = (((v * 13) * Math.PI) / 16);
}
}
}//package
Section 37
//Level_Up (Level_Up)
package {
import flash.media.*;
public dynamic class Level_Up extends Sound {
}
}//package
Section 38
//Menu (Menu)
package {
import flash.display.*;
public dynamic class Menu extends SimpleButton {
}
}//package
Section 39
//MochiAd (MochiAd)
package {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.net.*;
import flash.system.*;
public class MochiAd {
public function MochiAd(){
super();
}
public static function getVersion():String{
return ("2.5");
}
public static function showClickAwayAd(options:Object):void{
var clip:Object;
var mc:MovieClip;
var chk:MovieClip;
var options = options;
var DEFAULTS:Object = {ad_timeout:2000, regpt:"o", method:"showClickAwayAd", res:"300x250", no_bg:true, ad_started:function ():void{
}, ad_finished:function ():void{
}, ad_loaded:function (width:Number, height:Number):void{
}, ad_failed:function ():void{
trace("[MochiAd] Couldn't load an ad, make sure your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_skipped:function ():void{
}};
options = MochiAd._parseOptions(options, DEFAULTS);
clip = options.clip;
var ad_timeout:Number = options.ad_timeout;
delete options.ad_timeout;
if (!MochiAd.load(options)){
options.ad_failed();
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
MochiAd._cleanup(mc);
options.ad_finished();
};
var wh:Array = MochiAd._getRes(options, clip);
var w:Number = wh[0];
var h:Number = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
mc.unloadAd = function ():void{
MochiAd.unload(clip);
};
mc.adLoaded = options.ad_loaded;
mc.adSkipped = options.ad_skipped;
mc.rpc = function (callbackID:Number, arg:Object):void{
MochiAd.rpc(clip, callbackID, arg);
};
var sendHostProgress:Boolean;
mc.regContLC = function (lc_name:String):void{
mc._containerLCName = lc_name;
};
chk["onEnterFrame"] = function ():void{
var total:Number;
if (!this.parent){
delete this.onEnterFrame;
return;
};
var ad_clip:Object = this.parent._mochiad_ctr;
var elapsed:Number = (getTimer() - this.started);
var finished:Boolean;
if (!chk.showing){
total = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal;
if (total > 0){
chk.showing = true;
finished = true;
chk.started = getTimer();
} else {
if (elapsed > chk.ad_timeout){
options.ad_failed();
finished = true;
};
};
};
if (this.root == null){
finished = true;
};
if (finished){
delete this.onEnterFrame;
};
};
doOnEnterFrame(chk);
}
public static function _isNetworkAvailable():Boolean{
return (!((Security.sandboxType == "localWithFile")));
}
public static function _allowDomains(server:String):String{
var hostname:String = server.split("/")[2].split(":")[0];
Security.allowDomain("*");
Security.allowDomain(hostname);
Security.allowInsecureDomain("*");
Security.allowInsecureDomain(hostname);
return (hostname);
}
public static function unload(clip:Object):Boolean{
if (((clip.clip) && (clip.clip._mochiad))){
clip = clip.clip;
};
if (clip.origFrameRate != undefined){
clip.stage.frameRate = clip.origFrameRate;
};
if (!clip._mochiad){
return (false);
};
if (clip._mochiad._containerLCName != undefined){
clip._mochiad.lc.send(clip._mochiad._containerLCName, "notify", {id:"unload"});
};
if (clip._mochiad.onUnload){
clip._mochiad.onUnload();
};
delete clip._mochiad_loaded;
delete clip._mochiad;
return (true);
}
public static function showInterLevelAd(options:Object):void{
var clip:Object;
var mc:MovieClip;
var chk:MovieClip;
var options = options;
var DEFAULTS:Object = {ad_timeout:2000, fadeout_time:250, regpt:"o", method:"showTimedAd", ad_started:function ():void{
if ((this.clip is MovieClip)){
this.clip.stop();
} else {
throw (new Error("MochiAd.showInterLevelAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_finished:function ():void{
if ((this.clip is MovieClip)){
this.clip.play();
} else {
throw (new Error("MochiAd.showInterLevelAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_loaded:function (width:Number, height:Number):void{
}, ad_failed:function ():void{
trace("[MochiAd] Couldn't load an ad, make sure your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_skipped:function ():void{
}};
options = MochiAd._parseOptions(options, DEFAULTS);
clip = options.clip;
var ad_msec:Number = 11000;
var ad_timeout:Number = options.ad_timeout;
delete options.ad_timeout;
var fadeout_time:Number = options.fadeout_time;
delete options.fadeout_time;
if (!MochiAd.load(options)){
options.ad_failed();
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
MochiAd._cleanup(mc);
options.ad_finished();
};
var wh:Array = MochiAd._getRes(options, clip);
var w:Number = wh[0];
var h:Number = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.ad_msec = ad_msec;
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function ():void{
if (!this.parent){
delete this.onEnterFrame;
delete this.fadeFunction;
return;
};
var p:Number = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time)));
if (p > 0){
this.parent.alpha = (p * 0.01);
} else {
MochiAd.unload(clip);
delete this["onEnterFrame"];
};
};
mc.unloadAd = function ():void{
MochiAd.unload(clip);
};
mc.adLoaded = options.ad_loaded;
mc.adSkipped = options.ad_skipped;
mc.adjustProgress = function (msec:Number):void{
var _chk:Object = mc._mochiad_wait;
_chk.server_control = true;
_chk.showing = true;
_chk.started = getTimer();
_chk.ad_msec = (msec - 250);
};
mc.rpc = function (callbackID:Number, arg:Object):void{
MochiAd.rpc(clip, callbackID, arg);
};
chk["onEnterFrame"] = function ():void{
var total:Number;
if (!this.parent){
delete this.onEnterFrame;
delete this.fadeFunction;
return;
};
var ad_clip:Object = this.parent._mochiad_ctr;
var elapsed:Number = (getTimer() - this.started);
var finished:Boolean;
if (!chk.showing){
total = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal;
if (total > 0){
chk.showing = true;
chk.started = getTimer();
MochiAd.adShowing(clip);
} else {
if (elapsed > chk.ad_timeout){
options.ad_failed();
finished = true;
};
};
};
if (elapsed > chk.ad_msec){
finished = true;
};
if (finished){
if (this.server_control){
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = this.fadeFunction;
};
};
};
doOnEnterFrame(chk);
}
public static function _parseOptions(options:Object, defaults:Object):Object{
var k:String;
var pairs:Array;
var i:Number;
var kv:Array;
var optcopy:Object = {};
for (k in defaults) {
optcopy[k] = defaults[k];
};
if (options){
for (k in options) {
optcopy[k] = options[k];
};
};
if (optcopy.clip == undefined){
throw (new Error("MochiAd is missing the 'clip' parameter. This should be a MovieClip, Sprite or an instance of a class that extends MovieClip or Sprite."));
};
options = optcopy.clip.loaderInfo.parameters.mochiad_options;
if (options){
pairs = options.split("&");
i = 0;
while (i < pairs.length) {
kv = pairs[i].split("=");
optcopy[unescape(kv[0])] = unescape(kv[1]);
i++;
};
};
if (optcopy.id == "test"){
trace("[MochiAd] WARNING: Using the MochiAds test identifier, make sure to use the code from your dashboard, not this example!");
};
return (optcopy);
}
public static function _cleanup(mc:Object):void{
var k:String;
var lc:LocalConnection;
var f:Function;
var mc = mc;
if (("lc" in mc)){
lc = mc.lc;
f = function ():void{
lc.client = null;
lc.close();
//unresolved jump
var _slot1 = e;
};
setTimeout(f, 0);
};
var idx:Number = DisplayObjectContainer(mc).numChildren;
while (idx > 0) {
idx = (idx - 1);
DisplayObjectContainer(mc).removeChildAt(idx);
};
for (k in mc) {
delete mc[k];
};
}
public static function load(options:Object):MovieClip{
var clip:Object;
var k:String;
var server:String;
var hostname:String;
var lc:LocalConnection;
var name:String;
var loader:Loader;
var g:Function;
var req:URLRequest;
var v:Object;
var options = options;
var DEFAULTS:Object = {server:"http://x.mochiads.com/srv/1/", method:"load", depth:10333, id:"_UNKNOWN_"};
options = MochiAd._parseOptions(options, DEFAULTS);
options.swfv = 9;
options.mav = MochiAd.getVersion();
clip = options.clip;
if (!MochiAd._isNetworkAvailable()){
return (null);
};
if (clip._mochiad_loaded){
return (null);
};
//unresolved jump
var _slot1 = e;
throw (new Error("MochiAd requires a clip that is an instance of a dynamic class. If your class extends Sprite or MovieClip, you must make it dynamic."));
var depth:Number = options.depth;
delete options.depth;
var mc:MovieClip = createEmptyMovieClip(clip, "_mochiad", depth);
var wh:Array = MochiAd._getRes(options, clip);
options.res = ((wh[0] + "x") + wh[1]);
options.server = (options.server + options.id);
delete options.id;
clip._mochiad_loaded = true;
if (clip.loaderInfo.loaderURL.indexOf("http") == 0){
options.as3_swf = clip.loaderInfo.loaderURL;
};
var lv:URLVariables = new URLVariables();
for (k in options) {
v = options[k];
if (!(v is Function)){
lv[k] = v;
};
};
server = lv.server;
delete lv.server;
hostname = _allowDomains(server);
lc = new LocalConnection();
lc.client = mc;
name = ["", Math.floor(new Date().getTime()), Math.floor((Math.random() * 999999))].join("_");
lc.allowDomain("*", "localhost");
lc.allowInsecureDomain("*", "localhost");
lc.connect(name);
mc.lc = lc;
mc.lcName = name;
lv.lc = name;
lv.st = getTimer();
loader = new Loader();
g = function (ev:Object):void{
ev.target.removeEventListener(ev.type, arguments.callee);
MochiAd.unload(clip);
};
loader.contentLoaderInfo.addEventListener(Event.UNLOAD, g);
req = new URLRequest((server + ".swf"));
req.contentType = "application/x-www-form-urlencoded";
req.method = URLRequestMethod.POST;
req.data = lv;
loader.load(req);
mc.addChild(loader);
mc._mochiad_ctr = loader;
return (mc);
}
public static function runMethod(base:Object, methodName:String, argsArray:Array):Object{
var nameArray:Array = methodName.split(".");
var i:Number = 0;
while (i < (nameArray.length - 1)) {
if ((((base[nameArray[i]] == undefined)) || ((base[nameArray[i]] == null)))){
return (undefined);
};
base = base[nameArray[i]];
i++;
};
if (typeof(base[nameArray[i]]) == "function"){
return (base[nameArray[i]].apply(base, argsArray));
};
return (undefined);
}
public static function createEmptyMovieClip(parent:Object, name:String, depth:Number):MovieClip{
var mc:MovieClip = new MovieClip();
if (((false) && (depth))){
parent.addChildAt(mc, depth);
} else {
parent.addChild(mc);
};
parent[name] = mc;
mc["_name"] = name;
return (mc);
}
public static function _getRes(options:Object, clip:Object):Array{
var xy:Array;
var b:Object = clip.getBounds(clip.root);
var w:Number = 0;
var h:Number = 0;
if (typeof(options.res) != "undefined"){
xy = options.res.split("x");
w = parseFloat(xy[0]);
h = parseFloat(xy[1]);
} else {
w = (b.xMax - b.xMin);
h = (b.yMax - b.yMin);
};
if ((((w == 0)) || ((h == 0)))){
w = clip.stage.stageWidth;
h = clip.stage.stageHeight;
};
return ([w, h]);
}
public static function adShowing(mc:Object):void{
mc.origFrameRate = mc.stage.frameRate;
mc.stage.frameRate = 30;
}
public static function getValue(base:Object, objectName:String):Object{
var nameArray:Array = objectName.split(".");
var i:Number = 0;
while (i < (nameArray.length - 1)) {
if ((((base[nameArray[i]] == undefined)) || ((base[nameArray[i]] == null)))){
return (undefined);
};
base = base[nameArray[i]];
i++;
};
return (base[nameArray[i]]);
}
public static function rpc(clip:Object, callbackID:Number, arg:Object):void{
var _local4:Object;
var _local5:Object;
switch (arg.id){
case "setValue":
MochiAd.setValue(clip, arg.objectName, arg.value);
break;
case "getValue":
_local4 = MochiAd.getValue(clip, arg.objectName);
clip._mochiad.lc.send(clip._mochiad._containerLCName, "rpcResult", callbackID, _local4);
break;
case "runMethod":
_local5 = MochiAd.runMethod(clip, arg.method, arg.args);
clip._mochiad.lc.send(clip._mochiad._containerLCName, "rpcResult", callbackID, _local5);
break;
default:
trace(("[mochiads rpc] unknown rpc id: " + arg.id));
};
}
public static function setValue(base:Object, objectName:String, value:Object):void{
var nameArray:Array = objectName.split(".");
var i:Number = 0;
while (i < (nameArray.length - 1)) {
if ((((base[nameArray[i]] == undefined)) || ((base[nameArray[i]] == null)))){
return;
};
base = base[nameArray[i]];
i++;
};
base[nameArray[i]] = value;
}
public static function showPreGameAd(options:Object):void{
var clip:Object;
var mc:MovieClip;
var chk:MovieClip;
var complete:Boolean;
var unloaded:Boolean;
var sendHostProgress:Boolean;
var r:MovieClip;
var options = options;
var DEFAULTS:Object = {ad_timeout:3000, fadeout_time:250, regpt:"o", method:"showPreloaderAd", color:0xFF8A00, background:16777161, outline:13994812, no_progress_bar:false, ad_started:function ():void{
if ((this.clip is MovieClip)){
this.clip.stop();
} else {
throw (new Error("MochiAd.showPreGameAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_finished:function ():void{
if ((this.clip is MovieClip)){
this.clip.play();
} else {
throw (new Error("MochiAd.showPreGameAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_loaded:function (width:Number, height:Number):void{
}, ad_failed:function ():void{
trace("[MochiAd] Couldn't load an ad, make sure your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_skipped:function ():void{
}, ad_progress:function (percent:Number):void{
}};
options = MochiAd._parseOptions(options, DEFAULTS);
if ("c862232051e0a94e1c3609b3916ddb17".substr(0) == "dfeada81ac97cde83665f81c12da7def"){
options.ad_started();
setTimeout(options.ad_finished, 100);
return;
};
clip = options.clip;
var ad_msec:Number = 11000;
var ad_timeout:Number = options.ad_timeout;
delete options.ad_timeout;
var fadeout_time:Number = options.fadeout_time;
delete options.fadeout_time;
if (!MochiAd.load(options)){
options.ad_failed();
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
MochiAd._cleanup(mc);
var fn:Function = function ():void{
options.ad_finished();
};
setTimeout(fn, 100);
};
var wh:Array = MochiAd._getRes(options, clip);
var w:Number = wh[0];
var h:Number = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.x = (w * -0.5);
chk.y = (h * -0.5);
var bar:MovieClip = createEmptyMovieClip(chk, "_mochiad_bar", 4);
if (options.no_progress_bar){
bar.visible = false;
delete options.no_progress_bar;
} else {
bar.x = 10;
bar.y = (h - 20);
};
var bar_color:Number = options.color;
delete options.color;
var bar_background:Number = options.background;
delete options.background;
var bar_outline:Number = options.outline;
delete options.outline;
var backing_mc:MovieClip = createEmptyMovieClip(bar, "_outline", 1);
var backing:Object = backing_mc.graphics;
backing.beginFill(bar_background);
backing.moveTo(0, 0);
backing.lineTo((w - 20), 0);
backing.lineTo((w - 20), 10);
backing.lineTo(0, 10);
backing.lineTo(0, 0);
backing.endFill();
var inside_mc:MovieClip = createEmptyMovieClip(bar, "_inside", 2);
var inside:Object = inside_mc.graphics;
inside.beginFill(bar_color);
inside.moveTo(0, 0);
inside.lineTo((w - 20), 0);
inside.lineTo((w - 20), 10);
inside.lineTo(0, 10);
inside.lineTo(0, 0);
inside.endFill();
inside_mc.scaleX = 0;
var outline_mc:MovieClip = createEmptyMovieClip(bar, "_outline", 3);
var outline:Object = outline_mc.graphics;
outline.lineStyle(0, bar_outline, 100);
outline.moveTo(0, 0);
outline.lineTo((w - 20), 0);
outline.lineTo((w - 20), 10);
outline.lineTo(0, 10);
outline.lineTo(0, 0);
chk.ad_msec = ad_msec;
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
chk.last_pcnt = 0;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function ():void{
var p:Number = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time)));
if (p > 0){
this.parent.alpha = (p * 0.01);
} else {
MochiAd.unload(clip);
delete this["onEnterFrame"];
};
};
complete = false;
unloaded = false;
var f:Function = function (ev:Event):void{
ev.target.removeEventListener(ev.type, arguments.callee);
complete = true;
if (unloaded){
MochiAd.unload(clip);
};
};
clip.loaderInfo.addEventListener(Event.COMPLETE, f);
if ((clip.root is MovieClip)){
r = (clip.root as MovieClip);
if (r.framesLoaded >= r.totalFrames){
complete = true;
};
};
mc.unloadAd = function ():void{
unloaded = true;
if (complete){
MochiAd.unload(clip);
};
};
mc.adLoaded = options.ad_loaded;
mc.adSkipped = options.ad_skipped;
mc.adjustProgress = function (msec:Number):void{
var _chk:Object = mc._mochiad_wait;
_chk.server_control = true;
_chk.showing = true;
_chk.started = getTimer();
_chk.ad_msec = msec;
};
mc.rpc = function (callbackID:Number, arg:Object):void{
MochiAd.rpc(clip, callbackID, arg);
};
mc.rpcTestFn = function (s:String):Object{
trace(("[MOCHIAD rpcTestFn] " + s));
return (s);
};
mc.regContLC = function (lc_name:String):void{
mc._containerLCName = lc_name;
};
sendHostProgress = false;
mc.sendHostLoadProgress = function (lc_name:String):void{
sendHostProgress = true;
};
chk["onEnterFrame"] = function ():void{
var total:Number;
if (((!(this.parent)) || (!(this.parent.parent)))){
delete this["onEnterFrame"];
return;
};
var _clip:Object = this.parent.parent.root;
var ad_clip:Object = this.parent._mochiad_ctr;
var elapsed:Number = (getTimer() - this.started);
var finished:Boolean;
var clip_total:Number = _clip.loaderInfo.bytesTotal;
var clip_loaded:Number = _clip.loaderInfo.bytesLoaded;
if (complete){
clip_loaded = Math.max(1, clip_loaded);
clip_total = clip_loaded;
};
var clip_pcnt:Number = ((100 * clip_loaded) / clip_total);
var ad_pcnt:Number = ((100 * elapsed) / chk.ad_msec);
var _inside:Object = this._mochiad_bar._inside;
var pcnt:Number = Math.min(100, Math.min(((clip_pcnt) || (0)), ad_pcnt));
pcnt = Math.max(this.last_pcnt, pcnt);
this.last_pcnt = pcnt;
_inside.scaleX = (pcnt * 0.01);
options.ad_progress(pcnt);
if (sendHostProgress){
clip._mochiad.lc.send(clip._mochiad._containerLCName, "notify", {id:"hostLoadPcnt", pcnt:clip_pcnt});
if (clip_pcnt == 100){
sendHostProgress = false;
};
};
if (!chk.showing){
total = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal;
if (total > 0){
chk.showing = true;
chk.started = getTimer();
MochiAd.adShowing(clip);
} else {
if ((((elapsed > chk.ad_timeout)) && ((clip_pcnt == 100)))){
options.ad_failed();
finished = true;
};
};
};
if (elapsed > chk.ad_msec){
finished = true;
};
if (((complete) && (finished))){
if (this.server_control){
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = chk.fadeFunction;
};
Goo.itself.dispatchEvent(new Event("MOCHI"));
};
};
doOnEnterFrame(chk);
}
public static function showPreloaderAd(options:Object):void{
trace("[MochiAd] DEPRECATED: showPreloaderAd was renamed to showPreGameAd in 2.0");
MochiAd.showPreGameAd(options);
}
public static function showTimedAd(options:Object):void{
trace("[MochiAd] DEPRECATED: showTimedAd was renamed to showInterLevelAd in 2.0");
MochiAd.showInterLevelAd(options);
}
public static function doOnEnterFrame(mc:MovieClip):void{
var mc = mc;
var f:Function = function (ev:Object):void{
if (((("onEnterFrame" in mc)) && (mc.onEnterFrame))){
mc.onEnterFrame();
} else {
ev.target.removeEventListener(ev.type, arguments.callee);
};
};
mc.addEventListener(Event.ENTER_FRAME, f);
}
}
}//package
Section 40
//NamesAndScores (NamesAndScores)
package {
import flash.display.*;
public dynamic class NamesAndScores extends MovieClip {
public var score1:ScoreText;
public var name0:NameText;
public var name1:NameText;
public var name3:NameText;
public var name4:NameText;
public var name6:NameText;
public var name8:NameText;
public var name2:NameText;
public var score5:ScoreText;
public var name5:NameText;
public var name7:NameText;
public var score6:ScoreText;
public var name9:NameText;
public var rank0:RankText;
public var rank3:RankText;
public var rank6:RankText;
public var rank5:RankText;
public var rank2:RankText;
public var rank4:RankText;
public var rank7:RankText;
public var rank1:RankText;
public var rank9:RankText;
public var rank8:RankText;
public var score0:ScoreText;
public var score2:ScoreText;
public var score3:ScoreText;
public var score7:ScoreText;
public var score8:ScoreText;
public var score4:ScoreText;
public var score9:ScoreText;
}
}//package
Section 41
//NameText (NameText)
package {
import flash.display.*;
import flash.text.*;
public dynamic class NameText extends MovieClip {
public var nameText:TextField;
}
}//package
Section 42
//Next (Next)
package {
import flash.display.*;
public dynamic class Next extends SimpleButton {
}
}//package
Section 43
//Opening (Opening)
package {
import flash.events.*;
public class Opening extends Screen {
private var AH:ArtHavoc;
private var intro:Intro;
public var blobber:Blobber;
public static var itself:Opening;
public function Opening(){
super();
itself = this;
init();
}
private function help(e:MouseEvent):void{
Goo.displayInfoErrorOptions("INFO");
}
private function highScores(e:MouseEvent):void{
intro.highScores.removeEventListener(MouseEvent.CLICK, highScores);
Goo.preparePidgeon("VIEW");
Goo.itself.swapScreens(this, 4);
}
override public function cleanUp():void{
intro.highScores.removeEventListener(MouseEvent.CLICK, highScores);
intro.help.removeEventListener(MouseEvent.CLICK, help);
intro.menu.removeEventListener(MouseEvent.CLICK, menu);
removeChild(intro);
}
private function init():void{
intro = new Intro();
addChild(intro);
AH = new ArtHavoc();
AH.x = 28;
AH.y = 28;
intro.addChild(AH);
blobber = new Blobber(420);
intro.addChild(blobber);
intro.highScores.addEventListener(MouseEvent.CLICK, highScores);
intro.help.addEventListener(MouseEvent.CLICK, help);
intro.menu.addEventListener(MouseEvent.CLICK, menu);
}
override public function onEnterFrame():void{
}
private function menu(e:MouseEvent):void{
Goo.displayInfoErrorOptions("OPTIONS");
}
}
}//package
Section 44
//Options (Options)
package {
import flash.events.*;
import flash.media.*;
public class Options extends Screen {
private var AH:ArtHavoc;
private var volumeKnobSFX:Knob;
private var volumeKnobBGM:Knob;
private var volumeKnobGLOBAL:Knob;
private var menu:Buttons_Menu;
public static var caller:Screen;
public function Options(game:Boolean=false){
super();
init();
}
public function setDials():void{
volumeKnobSFX.volume = DJ.sfxChannel.soundTransform.volume;
volumeKnobBGM.volume = DJ.bgmChannel.soundTransform.volume;
volumeKnobGLOBAL.volume = SoundMixer.soundTransform.volume;
}
private function title(e:MouseEvent):void{
Goo.displayInfoErrorOptions("OPTIONS", true);
Goo.itself.swapScreens(Goo.displayChild, 0);
}
override public function persistentOnEnterFrame():void{
if (volumeKnobSFX.downDial){
volumeKnobSFX.adjustDial();
};
if (volumeKnobBGM.downDial){
volumeKnobBGM.adjustDial();
};
if (volumeKnobGLOBAL.downDial){
volumeKnobGLOBAL.adjustDial();
};
}
private function back(e:MouseEvent):void{
if (caller == GooGame.itself){
GooGame.itself.unpause();
return;
};
if (caller == Opening.itself){
DJ.hitItBGM("DRUMS");
};
Goo.displayInfoErrorOptions("OPTIONS", true);
}
private function init():void{
menu = new Buttons_Menu();
addChild(menu);
AH = new ArtHavoc();
AH.x = 0x0100;
AH.y = 48;
menu.addChild(AH);
volumeKnobSFX = new Knob(false, "SFX");
volumeKnobSFX.x = 88;
volumeKnobSFX.y = 88;
volumeKnobBGM = new Knob(false, "BGM");
volumeKnobBGM.x = 88;
volumeKnobBGM.y = 312;
volumeKnobGLOBAL = new Knob(true);
volumeKnobGLOBAL.x = 44;
volumeKnobGLOBAL.y = 200;
menu.addChild(volumeKnobSFX);
menu.addChild(volumeKnobBGM);
menu.addChild(volumeKnobGLOBAL);
volumeKnobSFX.addEventListener(MouseEvent.ROLL_OVER, volumeKnobSFX.listen);
volumeKnobSFX.addEventListener(MouseEvent.ROLL_OUT, volumeKnobSFX.unlisten);
volumeKnobBGM.addEventListener(MouseEvent.ROLL_OVER, volumeKnobBGM.listen);
volumeKnobBGM.addEventListener(MouseEvent.ROLL_OUT, volumeKnobBGM.unlisten);
volumeKnobGLOBAL.addEventListener(MouseEvent.ROLL_OVER, volumeKnobGLOBAL.listen);
volumeKnobGLOBAL.addEventListener(MouseEvent.ROLL_OUT, volumeKnobGLOBAL.unlisten);
menu.back.addEventListener(MouseEvent.CLICK, back);
menu.title.addEventListener(MouseEvent.CLICK, title);
}
}
}//package
Section 45
//Ouch_1 (Ouch_1)
package {
import flash.media.*;
public dynamic class Ouch_1 extends Sound {
}
}//package
Section 46
//Previous (Previous)
package {
import flash.display.*;
public dynamic class Previous extends SimpleButton {
}
}//package
Section 47
//Quit (Quit)
package {
import flash.display.*;
public dynamic class Quit extends SimpleButton {
}
}//package
Section 48
//RankText (RankText)
package {
import flash.display.*;
import flash.text.*;
public dynamic class RankText extends MovieClip {
public var rankText:TextField;
}
}//package
Section 49
//Reconnect (Reconnect)
package {
import flash.display.*;
public dynamic class Reconnect extends SimpleButton {
}
}//package
Section 50
//Retry (Retry)
package {
import flash.display.*;
public dynamic class Retry extends SimpleButton {
}
}//package
Section 51
//ScoreBoard (ScoreBoard)
package {
import flash.events.*;
public class ScoreBoard extends Screen {
private var scoreBoardOffset:int;
public var blobber:Blobber;
private var scoreBoard:Buttons_ScoreBoard;
private var AH:ArtHavoc;
public static var itself:ScoreBoard;
public function ScoreBoard():void{
trace("OP");
super();
itself = this;
init();
}
override public function cleanUp():void{
scoreBoard.title.removeEventListener(MouseEvent.CLICK, title);
scoreBoard.next.removeEventListener(MouseEvent.CLICK, next);
scoreBoard.previous.removeEventListener(MouseEvent.CLICK, previous);
removeChild(scoreBoard);
}
private function show(e:Event):void{
scoreBoard = new Buttons_ScoreBoard();
addChild(scoreBoard);
AH = new ArtHavoc();
AH.x = 28;
AH.y = 28;
scoreBoard.addChild(AH);
blobber = new Blobber(500, true);
blobber.scaleX = (blobber.scaleY = 0.5);
scoreBoard.addChild(blobber);
scoreBoard.title.addEventListener(MouseEvent.CLICK, title);
scoreBoard.next.addEventListener(MouseEvent.CLICK, next);
scoreBoard.previous.addEventListener(MouseEvent.CLICK, previous);
updateScoreBoard(scoreBoardOffset);
}
private function init():void{
itself.addEventListener("TOP_SCORE_UPDATE", show);
scoreBoardOffset = 0;
}
private function previous(e:MouseEvent):void{
scoreBoardOffset = (scoreBoardOffset - 10);
if (scoreBoardOffset <= 0){
scoreBoardOffset = 0;
};
trace(scoreBoardOffset);
updateScoreBoard(scoreBoardOffset);
}
private function title(e:MouseEvent):void{
scoreBoard.title.removeEventListener(MouseEvent.CLICK, title);
Goo.itself.swapScreens(this, 0);
}
private function next(e:MouseEvent):void{
scoreBoardOffset = (scoreBoardOffset + 10);
if (scoreBoardOffset >= (Goo.topHundredScores.length - 10)){
scoreBoardOffset = (Goo.topHundredScores.length - 10);
};
updateScoreBoard(scoreBoardOffset);
}
override public function onEnterFrame():void{
}
private function updateScoreBoard(o:uint):void{
scoreBoard.namesANDscores.rank0.rankText.text = Goo.topHundredScores[(0 + o)][0];
scoreBoard.namesANDscores.score0.scoreText.text = Goo.topHundredScores[(0 + o)][1];
scoreBoard.namesANDscores.name0.nameText.text = Goo.topHundredScores[(0 + o)][2];
scoreBoard.namesANDscores.rank1.rankText.text = Goo.topHundredScores[(1 + o)][0];
scoreBoard.namesANDscores.score1.scoreText.text = Goo.topHundredScores[(1 + o)][1];
scoreBoard.namesANDscores.name1.nameText.text = Goo.topHundredScores[(1 + o)][2];
scoreBoard.namesANDscores.rank2.rankText.text = Goo.topHundredScores[(2 + o)][0];
scoreBoard.namesANDscores.score2.scoreText.text = Goo.topHundredScores[(2 + o)][1];
scoreBoard.namesANDscores.name2.nameText.text = Goo.topHundredScores[(2 + o)][2];
scoreBoard.namesANDscores.rank3.rankText.text = Goo.topHundredScores[(3 + o)][0];
scoreBoard.namesANDscores.score3.scoreText.text = Goo.topHundredScores[(3 + o)][1];
scoreBoard.namesANDscores.name3.nameText.text = Goo.topHundredScores[(3 + o)][2];
scoreBoard.namesANDscores.rank4.rankText.text = Goo.topHundredScores[(4 + o)][0];
scoreBoard.namesANDscores.score4.scoreText.text = Goo.topHundredScores[(4 + o)][1];
scoreBoard.namesANDscores.name4.nameText.text = Goo.topHundredScores[(4 + o)][2];
scoreBoard.namesANDscores.rank5.rankText.text = Goo.topHundredScores[(5 + o)][0];
scoreBoard.namesANDscores.score5.scoreText.text = Goo.topHundredScores[(5 + o)][1];
scoreBoard.namesANDscores.name5.nameText.text = Goo.topHundredScores[(5 + o)][2];
scoreBoard.namesANDscores.rank6.rankText.text = Goo.topHundredScores[(6 + o)][0];
scoreBoard.namesANDscores.score6.scoreText.text = Goo.topHundredScores[(6 + o)][1];
scoreBoard.namesANDscores.name6.nameText.text = Goo.topHundredScores[(6 + o)][2];
scoreBoard.namesANDscores.rank7.rankText.text = Goo.topHundredScores[(7 + o)][0];
scoreBoard.namesANDscores.score7.scoreText.text = Goo.topHundredScores[(7 + o)][1];
scoreBoard.namesANDscores.name7.nameText.text = Goo.topHundredScores[(7 + o)][2];
scoreBoard.namesANDscores.rank8.rankText.text = Goo.topHundredScores[(8 + o)][0];
scoreBoard.namesANDscores.score8.scoreText.text = Goo.topHundredScores[(8 + o)][1];
scoreBoard.namesANDscores.name8.nameText.text = Goo.topHundredScores[(8 + o)][2];
scoreBoard.namesANDscores.rank9.rankText.text = Goo.topHundredScores[(9 + o)][0];
scoreBoard.namesANDscores.score9.scoreText.text = Goo.topHundredScores[(9 + o)][1];
scoreBoard.namesANDscores.name9.nameText.text = Goo.topHundredScores[(9 + o)][2];
}
}
}//package
Section 52
//ScoreText (ScoreText)
package {
import flash.display.*;
import flash.text.*;
public dynamic class ScoreText extends MovieClip {
public var scoreText:TextField;
}
}//package
Section 53
//Screen (Screen)
package {
import flash.events.*;
import flash.display.*;
public class Screen extends Sprite {
protected var screenHeight:Number;
protected var screenWidth:Number;
public function Screen():void{
super();
screenWidth = (Goo.center.x * 2);
screenHeight = (Goo.center.y * 2);
}
public function onEnterFrame():void{
}
public function onKeyDown(e:KeyboardEvent):void{
}
public function cleanUp():void{
}
public function persistentOnEnterFrame():void{
}
}
}//package
Section 54
//Slurp_1 (Slurp_1)
package {
import flash.media.*;
public dynamic class Slurp_1 extends Sound {
}
}//package
Section 55
//Submit (Submit)
package {
import flash.display.*;
public dynamic class Submit extends SimpleButton {
}
}//package
Section 56
//SubmitScore (SubmitScore)
package {
import flash.events.*;
public class SubmitScore extends Screen {
private var AH:ArtHavoc;
private var scoreSubmit:Buttons_Submit;
public var blobber:Blobber;
public static var playerName:String;
public static var nameANDscore:Array;
public static var itself:SubmitScore;
public function SubmitScore():void{
trace("AW");
super();
itself = this;
init();
}
private function help(e:MouseEvent):void{
Goo.displayInfoErrorOptions("INFO");
}
private function retry(e:MouseEvent):void{
scoreSubmit.retry.removeEventListener(MouseEvent.CLICK, retry);
Goo.itself.swapScreens(this, 1);
}
override public function cleanUp():void{
scoreSubmit.submit.removeEventListener(MouseEvent.CLICK, submitScore);
scoreSubmit.retry.removeEventListener(MouseEvent.CLICK, retry);
scoreSubmit.quit.removeEventListener(MouseEvent.CLICK, quit);
scoreSubmit.menu.removeEventListener(MouseEvent.CLICK, menu);
scoreSubmit.help.removeEventListener(MouseEvent.CLICK, help);
removeChild(scoreSubmit);
}
private function quit(e:MouseEvent):void{
scoreSubmit.quit.removeEventListener(MouseEvent.CLICK, quit);
Goo.itself.swapScreens(this, 0);
}
private function init():void{
scoreSubmit = new Buttons_Submit();
addChild(scoreSubmit);
AH = new ArtHavoc();
AH.x = 28;
AH.y = 28;
scoreSubmit.addChild(AH);
blobber = new Blobber(380);
scoreSubmit.addChild(blobber);
scoreSubmit.score.text = ("" + GooGame.score);
scoreSubmit.score.selectable = false;
scoreSubmit.signature.text = "YOUR SIGNATURE PLEASE";
scoreSubmit.signature.maxChars = 12;
scoreSubmit.submit.addEventListener(MouseEvent.CLICK, submitScore);
scoreSubmit.retry.addEventListener(MouseEvent.CLICK, retry);
scoreSubmit.quit.addEventListener(MouseEvent.CLICK, quit);
scoreSubmit.menu.addEventListener(MouseEvent.CLICK, menu);
scoreSubmit.help.addEventListener(MouseEvent.CLICK, help);
}
private function submitScore(e:MouseEvent):void{
playerName = scoreSubmit.signature.text;
if (playerName == "YOUR SIGNATURE PLEASE"){
playerName = "ANONYMOUS";
};
nameANDscore = new Array(GooGame.score, playerName);
Goo.preparePidgeon("INSERT", nameANDscore);
trace(("this is the message:" + Goo.pidgeonMessage));
scoreSubmit.submit.removeEventListener(MouseEvent.CLICK, submitScore);
Goo.itself.swapScreens(this, 4);
}
override public function onEnterFrame():void{
}
private function menu(e:MouseEvent):void{
Goo.displayInfoErrorOptions("OPTIONS");
}
}
}//package
Section 57
//Title (Title)
package {
import flash.display.*;
public dynamic class Title extends SimpleButton {
}
}//package
Section 58
//Tools (Tools)
package {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.net.*;
public class Tools extends Sprite {
public function Tools(){
super();
}
public static function checkAgainstArray(p:Point, radius:Number, a:Array):Boolean{
var _radius:Number;
var xDelta:Number;
var yDelta:Number;
var distance:Number;
var radii:Number;
var hit:Boolean = new Boolean(false);
var j:int;
while (j < (a.length + 1)) {
if (j == a.length){
_radius = Hero.itself.radius;
xDelta = (p.x - Hero.itself.x);
yDelta = (p.y - Hero.itself.y);
} else {
_radius = a[j].radius;
xDelta = (p.x - a[j].x);
yDelta = (p.y - a[j].y);
};
distance = Math.sqrt(((xDelta * xDelta) + (yDelta * yDelta)));
radii = (radius + _radius);
if (distance <= (radii + Goo.buffer)){
hit = true;
};
j++;
};
return (hit);
}
public static function releasePidgeon(pidgeon:String):void{
var birdCall:URLRequest = new URLRequest(pidgeon);
var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, pidgeonDeliverMessage);
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, onError);
loader.load(birdCall);
}
public static function resetContacts():void{
var j:int;
while (j < GooGame.mergingBlobs.length) {
GooGame.mergingBlobs[j].contacts = new Array();
j++;
};
}
public static function fullArc(o:Object, x:Number, y:Number, radius:Number, startAngle:Number, arc:Number, color:uint, alpha:Number=1):void{
var controlX:Number;
var controlY:Number;
var anchorX:Number;
var anchorY:Number;
var segment:Number = (arc / 8);
var nCtrlDist:Number = (radius / Math.cos((segment / 2)));
var angle:Number = startAngle;
var initialX:Number = (x + (Math.cos(startAngle) * radius));
var initialY:Number = (y + (Math.sin(startAngle) * radius));
o.graphics.clear();
if (arc > (Math.PI * 2)){
arc = 360;
};
o.graphics.lineStyle(0, 0, 0);
o.graphics.beginFill(color, alpha);
o.graphics.moveTo(x, y);
o.graphics.lineTo(initialX, initialY);
var i:Number = 0;
while (i < 8) {
angle = (angle + segment);
controlX = (x + (Math.cos((angle - (segment / 2))) * nCtrlDist));
controlY = (y + (Math.sin((angle - (segment / 2))) * nCtrlDist));
anchorX = (x + (Math.cos(angle) * radius));
anchorY = (y + (Math.sin(angle) * radius));
o.graphics.curveTo(controlX, controlY, anchorX, anchorY);
i++;
};
o.graphics.lineTo(x, y);
o.graphics.endFill();
}
public static function total():Number{
var total:Number;
var i:int;
while (i < arguments.length) {
total = (total + arguments[i]);
i++;
};
return (total);
}
public static function resizeWorld():void{
var heroRatio:Number = zeroTOone(Hero.itself.radius, Hero.initialRadius, Hero.maxRadius);
Goo.apparentWorldSize = ((Goo.worldSizeDelta * (1 - heroRatio)) + Goo.center.x);
Goo.targetWorldRatio = (Goo.apparentWorldSize / Goo.worldSize);
Goo.worldProportionDelta = ((Goo.apparentWorldSize - Goo.center.x) / Goo.worldSizeDelta);
Goo.visibleRadius = (Goo.center.x * (Goo.worldSize / Goo.apparentWorldSize));
GooGame.mapProportion = (44 / Goo.apparentWorldSize);
GooGame.itself.miniZoneDraw();
GooGame.resetHeroMoveRadius();
}
public static function mergeEase(b:Blob):Point{
var point:Point = new Point();
var xDelta:Number = (b.target.x - b.x);
var yDelta:Number = (b.target.y - b.y);
point.x = ((Goo.mergeEaseRate * xDelta) + b.x);
point.y = ((Goo.mergeEaseRate * yDelta) + b.y);
return (point);
}
public static function merge(b1:Blob, b2:Blob):void{
}
public static function drawBlob(b:Blob):void{
if (b != null){
b.scaleX = (b.scaleY = (b.radius / b.graphicRadius));
};
drawOutline(b);
}
public static function easeTo(p1:Point, p2:Point):Point{
var newPoint:Point;
var xDelta:Number = (p2.x - p1.x);
var yDelta:Number = (p2.y - p1.y);
if (xDelta > Goo.easeDamper){
xDelta = Goo.easeDamper;
};
if (xDelta < -(Goo.easeDamper)){
xDelta = -(Goo.easeDamper);
};
if (yDelta > Goo.easeDamper){
yDelta = Goo.easeDamper;
};
if (yDelta < -(Goo.easeDamper)){
yDelta = -(Goo.easeDamper);
};
if (Math.sqrt(((xDelta * xDelta) + (yDelta * yDelta))) <= Goo.quantum){
newPoint = new Point(p2.x, p2.y);
} else {
newPoint = new Point((p1.x + (xDelta * Goo.easeRate)), (p1.y + (yDelta * Goo.easeRate)));
};
return (newPoint);
}
public static function pidgeonDeliverMessage(e:Event):void{
var loaderInfo:LoaderInfo = LoaderInfo(e.target);
Goo.pidgeonSWF = loaderInfo.content;
Goo.pidgeonSWF.gooScoreArray(Goo.pidgeonRecipient, Goo.pidgeonMessage);
Goo.pidgeonSWF.addEventListener("DATA_UPDATE", recieveMessage);
}
public static function isContained(bIn:Blob, bOut:Blob):Boolean{
var contained:Boolean = new Boolean(false);
var xDelta:Number = (bOut.x - bIn.x);
var yDelta:Number = (bOut.y - bIn.y);
var distance:Number = Math.sqrt(((xDelta * xDelta) + (yDelta * yDelta)));
if ((distance + bIn.radius) < bOut.radius){
contained = true;
};
return (contained);
}
public static function checkArrayBlobs(b1:Array, b2:Array):void{
var j:int;
var newColor:uint;
var i:int = (b1.length - 1);
while (i >= 0) {
j = (b2.length - 1);
while (j >= 0) {
if (b1[i] != b2[j]){
if (checkAgainstBlob(b1[i], b2[j])){
newColor = Goo.colorBonus;
if ((((b1[i].color == Goo.colorMalus)) || ((b2[j].color == Goo.colorMalus)))){
newColor = Goo.colorMalus;
};
combineBlobs(b1[i], b2[j], newColor);
};
};
j--;
};
i--;
};
}
public static function popBlob(b:Blob, a:Array):void{
var last:Blob = a[(a.length - 1)];
var index:int = a.indexOf(b);
a[(a.length - 1)] = b;
a[index] = last;
a.pop();
}
public static function checkHero(a:Array):Boolean{
var i:int = (a.length - 1);
while (i >= 0) {
if (checkAgainstBlob(Hero.itself, a[i])){
if (a[i].color == Goo.colorBonus){
DJ.hitItSFX("BONUS");
Hero.itself.volume = (Hero.itself.volume + a[i].volume);
popBlob(a[i], GooGame.goodBlobs);
};
if (a[i].color == Goo.colorMalus){
DJ.hitItSFX("MALUS");
Hero.itself.volume = (Hero.itself.volume - a[i].volume);
popBlob(a[i], GooGame.evilBlobs);
if (Hero.itself.volume <= 0){
trace("DEAD!");
DJ.hitItSFX("DIE");
GooGame.itself.gameOver();
return (true);
};
};
destroyBlob(a[i]);
GooGame.blobs = Tools.combineArrays(GooGame.evilBlobs, GooGame.goodBlobs);
resizeWorld();
};
i--;
};
if (Hero.itself.volume >= Hero.maxVolume){
trace("WIN!");
Tools.removeAllChildren(GooGame.blobLayer);
GooGame.evilBlobs = new Array();
GooGame.goodBlobs = new Array();
GooGame.blobs = GooGame.evilBlobs.concat(GooGame.goodBlobs);
GooGame.itself.nextLevel();
};
return (false);
}
public static function proliferate(type:uint):Point{
var point:Point;
var index:uint;
var angle:Number;
var _x:Number;
var _y:Number;
var array:Array;
var tries:int;
var found:Boolean = new Boolean(false);
switch (type){
case Goo.colorBonus:
array = GooGame.goodBlobs;
break;
case Goo.colorMalus:
array = GooGame.evilBlobs;
break;
};
while (((!(found)) && ((tries <= Goo.maxTries)))) {
index = Math.floor((array.length * Math.random()));
angle = (((Math.random() * 2) * Math.PI) - Math.PI);
_x = (array[index].x + (Math.cos(angle) * ((Goo.buffer + vTOr(Goo.unitVolume)) + array[index].radius)));
_y = (array[index].y + (Math.sin(angle) * ((Goo.buffer + vTOr(Goo.unitVolume)) + array[index].radius)));
found = checkSpot(_x, _y);
if (found){
point = new Point(_x, _y);
};
tries++;
};
return (point);
}
public static function grow(b:Blob):void{
b.volume = (b.volume + 1);
drawBlob(b);
}
public static function checkBlobs(b:Array):void{
var j:int;
var newColor:uint;
var i:int = (b.length - 1);
while (i >= 0) {
j = (i - 1);
while (j >= 0) {
if ((((b[i].color == Goo.colorMalus)) || ((b[j].color == Goo.colorMalus)))){
if (checkAgainstBlob(b[i], b[j])){
newColor = Goo.colorBonus;
if ((((b[i].color == Goo.colorMalus)) || ((b[j].color == Goo.colorMalus)))){
newColor = Goo.colorMalus;
};
combineBlobs(b[i], b[j], newColor);
};
};
j--;
};
i--;
};
}
public static function inCircle(p:Point, radius:Number):Point{
var point:Point = new Point(p.x, p.y);
var xDelta:Number = p.x;
var yDelta:Number = p.y;
var distance:Number = Math.sqrt(((xDelta * xDelta) + (yDelta * yDelta)));
var angle:Number = Math.atan2(yDelta, xDelta);
if (distance > radius){
point.x = (Math.cos(angle) * radius);
point.y = (Math.sin(angle) * radius);
};
return (point);
}
public static function checkAgainstBlob(b1:Blob, b2:Blob):Boolean{
var hit:Boolean = new Boolean(false);
var b1X:int = b1.x;
var b1Y:int = b1.y;
var b1R:int = b1.radius;
var b2X:int = b2.x;
var b2Y:int = b2.y;
var b2R:int = b2.radius;
if ((b1X + b1R) < (b2X - b2R)){
return (false);
};
if ((b1X - b1R) > (b2X + b2R)){
return (false);
};
if ((b1Y + b1R) < (b2Y - b2R)){
return (false);
};
if ((b1Y - b1R) > (b2Y + b2R)){
return (false);
};
var xDelta:Number = (b2.x - b1.x);
var yDelta:Number = (b2.y - b1.y);
var distance:Number = Math.sqrt(((xDelta * xDelta) + (yDelta * yDelta)));
var radii:Number = (b1.radius + b2.radius);
if (distance <= radii){
return (true);
};
}
public static function combineArrays(a1:Array, a2:Array):Array{
var newArray:Array = a1.concat(a2);
return (newArray);
}
public static function removeAllChildren(t:Object):void{
while (t.numChildren > 0) {
t.removeChildAt(0);
};
}
public static function average():Number{
var total:Number;
var i:int;
while (i < arguments.length) {
total = (total + arguments[i]);
i++;
};
return ((total / arguments.length));
}
public static function paint(c:uint):ColorTransform{
var r = (c >> 16);
var g = ((c >> 8) & 0xFF);
var b = (c & 0xFF);
return (new ColorTransform(0, 0, 0, 1, r, g, b, 0));
}
public static function randomSelect():Object{
var index:int = Math.floor((Math.random() * arguments.length));
return (arguments[index]);
}
public static function distanceBetweenCirclesPoint(p:Point, r1:Number, r2:Number, scale:Number=1):Point{
var distance:Number;
var radius:Number = Math.sqrt(((p.x * p.x) + (p.y * p.y)));
var angle:Number = Math.atan2(p.y, p.x);
if (distance <= r1){
return (new Point(0, 0));
};
distance = zeroTOone(radius, r1, r2);
return (new Point(((Math.cos(angle) * distance) * scale), ((Math.sin(angle) * distance) * scale)));
}
public static function vTOr(v:Number):Number{
var r:Number = Math.pow((v * (3 / (4 * Math.PI))), (1 / 3));
return (r);
}
public static function zeroTOone(n:Number, min:Number, max:Number, inBounds:Boolean=true):Number{
var r:Number;
if (!inBounds){
return (((n - min) / (max - min)));
};
r = ((n - min) / (max - min));
if (r >= 1){
r = 1;
};
if (r <= 0){
r = 0;
};
return (r);
}
public static function foundSpot():Point{
var spot:Point;
var _x:Number;
var _y:Number;
var tries:int;
var found:Boolean = new Boolean(false);
while (((!(found)) && ((tries <= Goo.maxTries)))) {
_x = (GooGame.center.x * ((Math.random() * 2) - 1));
_y = (GooGame.center.y * ((Math.random() * 2) - 1));
found = checkSpot(_x, _y);
if (found){
spot = new Point(_x, _y);
};
tries++;
};
return (spot);
}
public static function drawOutline(b:Blob):void{
fullCircle(b.x, b.y, (b.radius + Goo.outline), b.colorEdge, GooGame.edges);
}
public static function moveBlob(b:Blob):void{
var here:Point = new Point(b.x, b.y);
var there:Point = new Point(blobTarget(b, b.contacts).x, blobTarget(b, b.contacts).y);
}
public static function transferBlob(b:Blob, a1:Array, a2:Array):void{
popBlob(b, a1);
a2.unshift(b);
}
public static function onError(error:IOErrorEvent):void{
trace(("AT LEAST THIS WORKS" + error));
Goo.displayInfoErrorOptions("ERROR");
}
public static function eraseBlob(object:Object):void{
object.graphics.clear();
}
public static function threshold(n:Number, z:Number):Number{
if (n > z){
n = (n - z);
return (n);
};
if (n < -(z)){
n = (n + z);
return (n);
};
n = 0;
return (n);
}
public static function recieveMessage(e:Event):void{
Goo.topHundredScores = Goo.pidgeonSWF.data;
Goo.itself.dispatchEvent(new Event("TOP_SCORE_READY"));
trace("HOT TAMALE!");
}
public static function cOFg(b1:Blob, b2:Blob):Point{
var point:Point;
var ratio:Number;
var xDelta:Number = (b2.x - b1.x);
var yDelta:Number = (b2.y - b1.y);
var total:Number = (b1.volume + b2.volume);
if (b1.volume < b2.volume){
ratio = (b1.volume / total);
} else {
if (b2.volume < b1.volume){
ratio = (b2.volume / total);
} else {
ratio = 0.5;
};
};
point = new Point((b1.x + (ratio * xDelta)), (b1.y + (ratio * yDelta)));
return (point);
}
public static function rTOv(r:Number):Number{
var v:Number = (((4 / 3) * Math.PI) * Math.pow(r, 3));
return (v);
}
public static function checkSpot(x:Number, y:Number):Boolean{
var found:Boolean = new Boolean(false);
var xDelta:Number = x;
var yDelta:Number = y;
var distance:Number = Math.sqrt(((xDelta * xDelta) + (yDelta * yDelta)));
if (((distance + Tools.vTOr(Goo.unitVolume)) + Goo.buffer) < Goo.worldSize){
if (!checkAgainstArray(new Point(x, y), vTOr(Goo.unitVolume), GooGame.blobs)){
found = true;
};
};
return (found);
}
public static function bounds(o:Object):void{
o.graphics.lineStyle(1, 0xFFFFFF);
o.graphics.drawRect(0, 0, o.width, o.height);
}
public static function destroyBlob(b:Blob):void{
b.parent.removeChild(b);
Tools.removeAllChildren(b);
b = null;
}
public static function clearBlobs(a:Array):void{
while (a.length > 0) {
destroyBlob(a[i]);
};
}
public static function createBlob(color:uint, seed:Boolean=true):void{
var blob:Blob;
var point:Point = new Point();
if (seed){
point = foundSpot();
} else {
point = proliferate(color);
};
if (point != null){
switch (color){
case Goo.colorMalus:
blob = new Blob(Goo.colorMalus);
GooGame.evilBlobs.unshift(blob);
break;
case Goo.colorBonus:
blob = new Blob(Goo.colorBonus);
GooGame.goodBlobs.unshift(blob);
break;
default:
return;
};
GooGame.emergingBlobs.unshift(blob);
GooGame.blobLayer.addChild(blob);
GooGame.blobs = Tools.combineArrays(GooGame.evilBlobs, GooGame.goodBlobs);
blob.x = point.x;
blob.y = point.y;
drawBlob(blob);
} else {
Goo.tracer = (Goo.tracer + "null works");
return;
};
}
public static function link(b1:Blob, b2:Blob):void{
b1.contacts.push(b2);
b2.contacts.push(b1);
}
public static function blobTarget(b:Blob, a:Array):Point{
var point:Point;
var x:Number;
var y:Number;
var CofG:Point;
var i:int;
while (i < a.length) {
CofG = new Point(cOFg(b, a[i]).x, cOFg(b, a[i]).y);
x = (x + CofG.x);
y = (y + CofG.y);
i++;
};
x = (x / a.length);
y = (y / a.length);
point = new Point(x, y);
Goo.tracer = ((((((("" + b.x) + ",") + b.y) + " : ") + point.x) + ",") + point.y);
return (point);
}
public static function totalArray(a:Array):uint{
var total:uint;
var i:int;
while (i < a.length) {
total = (total + a[i]);
i++;
};
return (total);
}
public static function combineBlobs(b1:Blob, b2:Blob, c:uint):void{
if (c == Goo.colorMalus){
if (b1.color == Goo.colorBonus){
transferBlob(b1, GooGame.goodBlobs, GooGame.evilBlobs);
};
if (b2.color == Goo.colorBonus){
transferBlob(b2, GooGame.goodBlobs, GooGame.evilBlobs);
};
b1.color = (b2.color = c);
b1.graphic.transform.colorTransform = (b2.graphic.transform.colorTransform = Tools.paint(c));
GooGame.blobs = Tools.combineArrays(GooGame.evilBlobs, GooGame.goodBlobs);
};
}
public static function fullCircle(x:Number, y:Number, radius:Number, color:uint, object:Object):void{
object.graphics.lineStyle(0, 0, 0);
object.graphics.beginFill(color);
object.graphics.drawCircle(x, y, radius);
object.graphics.endFill();
}
}
}//package
Section 59
//URLErrorMessage (URLErrorMessage)
package {
import flash.events.*;
public class URLErrorMessage extends Screen {
private var error:Buttons_URLError;
public function URLErrorMessage(){
super();
init();
}
private function init():void{
error = new Buttons_URLError();
addChild(error);
error.title.addEventListener(MouseEvent.CLICK, title);
error.reconnect.addEventListener(MouseEvent.CLICK, reconnect);
}
private function title(e:MouseEvent):void{
Goo.displayInfoErrorOptions("ERROR", true);
Goo.itself.swapScreens(Goo.displayChild, 0);
}
private function reconnect(e:MouseEvent):void{
Tools.releasePidgeon(Goo.carrierPidgeon);
}
}
}//package
Section 60
//World (World)
package {
import flash.display.*;
public dynamic class World extends MovieClip {
}
}//package