Section 1
//DifferenceTimer (GameElements.DifferenceTimer)
package GameElements {
import flash.utils.*;
public class DifferenceTimer {
private var pauseTime:int;// = 0
private var duration:int;// = 0
private var startTime:int;// = 0
public function DifferenceTimer(_arg1:int){
startTime = 0;
duration = 0;
pauseTime = 0;
super();
duration = _arg1;
startTime = getTimer();
}
public function start(){
startTime = getTimer();
}
public function unpause(){
startTime = (getTimer() - pauseTime);
}
public function getCountdown():int{
return ((duration - getDiff()));
}
public function getDur():int{
return (duration);
}
public function getFract():Number{
var _local1:Number;
_local1 = (getDiff() / duration);
return (_local1);
}
public function getDiff():int{
var _local1:int;
_local1 = (getTimer() - startTime);
return (_local1);
}
public function pause(){
pauseTime = (getTimer() - startTime);
}
}
}//package GameElements
Section 2
//GameBoard (GameElements.GameBoard)
package GameElements {
import flash.display.*;
public class GameBoard extends MovieClip {
private var startPosL:Array;
private var startPosR:Array;
private var offsetX:Number;
private var spaceW:Number;
private var boardRadius:int;// = 100
private var tx0:Number;
private var startX:Number;
private var tx1:Number;
private var triMask:MovieClip;
private var side:Number;
private var triLayer:MovieClip;
private var startY:Number;
private var triArray:Array;
private var boardWidth:int;
private var ty:Number;
private var boardHeight:int;
private var stagger:int;
private var gameSpaces:Array;
private var gameSegs:int;
private var orientation:String;
private var root3over2:Number;
private var root3over6:Number;
public function GameBoard(_arg1:int, _arg2:Array, _arg3:int){
boardRadius = 100;
orientation = new String("12");
triArray = new Array();
triLayer = new MovieClip();
triMask = new MovieClip();
startPosR = new Array(6);
startPosL = new Array(6);
super();
boardRadius = _arg3;
gameSegs = _arg1;
createGameBoard();
}
public function getTriArray(){
return (triArray);
}
public function getStartPos(_arg1:String):Array{
var _local2:Array;
switch (_arg1){
case "left":
switch (orientation){
case "12":
_local2 = startPosL[0];
break;
case "2":
_local2 = startPosL[1];
break;
case "4":
_local2 = startPosL[2];
break;
case "6":
_local2 = startPosL[3];
break;
case "8":
_local2 = startPosL[4];
break;
case "10":
_local2 = startPosL[5];
break;
};
break;
case "right":
switch (orientation){
case "12":
_local2 = startPosR[0];
break;
case "2":
_local2 = startPosR[1];
break;
case "4":
_local2 = startPosR[2];
break;
case "6":
_local2 = startPosR[3];
break;
case "8":
_local2 = startPosR[4];
break;
case "10":
_local2 = startPosR[5];
break;
};
break;
};
return (new Array(_local2, this.getRowColPos(_local2[0], _local2[1])));
}
public function setOrientation(_arg1:String):void{
orientation = _arg1;
switch (orientation){
case "10":
break;
case "2":
break;
case "12":
break;
case "4":
break;
case "6":
break;
case "8":
break;
};
}
public function getTriSpaces():Array{
var _local1:Array;
var _local2:int;
var _local3:int;
_local1 = new Array();
_local2 = 0;
while (_local2 < boardHeight) {
_local3 = 0;
while (_local3 < boardWidth) {
if (gameSpaces[_local2][_local3].getState() == "tri"){
_local1.push(gameSpaces[_local2][_local3]);
};
_local3++;
};
_local2++;
};
return (_local1);
}
public function getSpaceState(_arg1:int, _arg2:int):String{
var _local3:String;
var _local4:int;
var _local5:int;
_local3 = new String("nada");
_local4 = boardHeight;
_local5 = boardWidth;
if ((((((((_arg1 < _local4)) && ((_arg1 >= 0)))) && ((_arg2 < _local5)))) && ((_arg2 >= 0)))){
_local3 = GameSpace(gameSpaces[_arg1][_arg2]).getState();
} else {
_local3 = "out of bounds";
};
return (_local3);
}
public function getTumbleSpace(_arg1:int, _arg2:int, _arg3:String):Array{
var _local4:Array;
if (_arg3 == "right"){
switch (orientation){
case "12":
_local4 = new Array((_arg1 - 1), _arg2);
break;
case "10":
_local4 = new Array((_arg1 - 1), _arg2);
break;
case "8":
_local4 = new Array((_arg1 + 1), _arg2);
break;
case "6":
_local4 = new Array((_arg1 + 1), _arg2);
break;
case "4":
_local4 = new Array(_arg1, (_arg2 - 1));
break;
case "2":
_local4 = new Array(_arg1, (_arg2 - 1));
break;
};
} else {
if (_arg3 == "left"){
switch (orientation){
case "12":
_local4 = new Array((_arg1 - 1), _arg2);
break;
case "10":
_local4 = new Array(_arg1, (_arg2 + 1));
break;
case "8":
_local4 = new Array(_arg1, (_arg2 + 1));
break;
case "6":
_local4 = new Array((_arg1 + 1), _arg2);
break;
case "4":
_local4 = new Array((_arg1 + 1), _arg2);
break;
case "2":
_local4 = new Array((_arg1 - 1), _arg2);
break;
};
};
};
return (_local4);
}
public function tumbleTri(_arg1:GameTriangle):Boolean{
var _local2:Array;
var _local3:*;
var _local4:GameSpace;
_local2 = getTumbleSpace(_arg1.getRow(), _arg1.getCol(), _arg1.getDirection());
if (getSpaceState(_local2[0], _local2[1]) == "empty"){
_local3 = getGameSpace(_arg1.getRow(), _arg1.getCol());
_local4 = getGameSpace(_local2[0], _local2[1]);
_local4.setStateTri(_arg1);
_local3.setState("empty");
return (true);
};
return (false);
}
private function createGameBoard():void{
var _local1:int;
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:Array;
var _local6:int;
var _local7:int;
var _local8:String;
var _local9:int;
var _local10:int;
var _local11:int;
addChild(triLayer);
side = (boardRadius / gameSegs);
root3over6 = (Math.sqrt(3) / 6);
root3over2 = (Math.sqrt(3) / 2);
spaceW = ((side * Math.sqrt(3)) / 2);
ty = (side / 2);
tx0 = ((root3over6 * 2) * side);
tx1 = ((root3over6 * 4) * side);
offsetX = 0;
startX = 0;
startY = 0;
boardHeight = ((gameSegs * 4) - 1);
boardWidth = (gameSegs * 2);
gameSpaces = new Array(boardHeight);
stagger = 0;
if ((gameSegs % 2) == 0){
startY = (2 * boardRadius);
stagger = 1;
};
if ((gameSegs % 2) == 1){
startY = ((2 * boardRadius) - (side / 2));
stagger = 0;
};
_local1 = (0 + stagger);
while (_local1 < (boardHeight + stagger)) {
gameSpaces[(_local1 - stagger)] = new Array(boardWidth);
_local2 = 0;
while (_local2 < boardWidth) {
_local3 = (_local1 - stagger);
_local4 = _local2;
_local5 = getRowColPos(_local3, _local4);
_local6 = _local5[0];
_local7 = _local5[1];
_local8 = _local5[2];
gameSpaces[_local3][_local4] = new GameSpace(_local3, _local4, _local6, _local7, side, true, _local8);
triLayer.addChild(gameSpaces[_local3][_local4]);
_local2++;
};
_local1++;
};
if ((gameSegs % 2) == 0){
_local9 = 0;
while (_local9 < gameSegs) {
_local10 = 0;
while (_local10 < ((gameSegs - _local9) - 1)) {
gameSpaces[_local9][_local10].setState("out of bounds");
_local10++;
};
_local11 = boardWidth;
while (_local11 > ((gameSegs + _local9) + 1)) {
gameSpaces[_local9][(_local11 - 1)].setState("out of bounds");
_local11--;
};
_local9++;
};
_local9 = 0;
while (_local9 < gameSegs) {
_local10 = 0;
while (_local10 < ((gameSegs - _local9) - 1)) {
gameSpaces[((boardHeight - 1) - _local9)][_local10].setState("out of bounds");
_local10++;
};
_local11 = boardWidth;
while (_local11 > ((gameSegs + 1) + _local9)) {
gameSpaces[((boardHeight - 1) - _local9)][(_local11 - 1)].setState("out of bounds");
_local11--;
};
_local9++;
};
};
if ((gameSegs % 2) == 1){
_local9 = 0;
while (_local9 < gameSegs) {
_local10 = 0;
while (_local10 < ((gameSegs - _local9) - 1)) {
gameSpaces[_local9][_local10].setState("out of bounds");
_local10++;
};
_local11 = boardWidth;
while (_local11 > ((gameSegs + _local9) + 1)) {
gameSpaces[_local9][(_local11 - 1)].setState("out of bounds");
_local11--;
};
_local9++;
};
_local9 = 0;
while (_local9 < gameSegs) {
_local10 = 0;
while (_local10 < ((gameSegs - _local9) - 1)) {
gameSpaces[((boardHeight - 1) - _local9)][_local10].setState("out of bounds");
_local10++;
};
_local11 = boardWidth;
while (_local11 > ((gameSegs + 1) + _local9)) {
gameSpaces[((boardHeight - 1) - _local9)][(_local11 - 1)].setState("out of bounds");
_local11--;
};
_local9++;
};
};
triMask.graphics.lineStyle(1, 0, 1);
triMask.graphics.beginFill(0, 1);
triMask.graphics.drawCircle(boardRadius, 0, boardRadius);
addChild(triMask);
triLayer.mask = triMask;
startPosR[0] = new Array((boardHeight + 1), gameSegs);
startPosR[1] = new Array((gameSegs * 3), (gameSegs * 2));
startPosR[2] = new Array((gameSegs - 2), (gameSegs * 2));
startPosR[3] = new Array(-2, gameSegs);
startPosR[4] = new Array((gameSegs - 1), -1);
startPosR[5] = new Array(((gameSegs * 3) - 1), -1);
startPosL[0] = new Array((boardHeight + 1), (gameSegs - 1));
startPosL[1] = new Array(((gameSegs * 3) - 1), (gameSegs * 2));
startPosL[2] = new Array((gameSegs - 1), (gameSegs * 2));
startPosL[3] = new Array(-2, (gameSegs - 1));
startPosL[4] = new Array((gameSegs - 2), -1);
startPosL[5] = new Array((gameSegs * 3), -1);
}
public function addTri(_arg1:GameTriangle):void{
triLayer.addChild(_arg1);
addTriToArray(_arg1);
}
public function addTriToArray(_arg1:GameTriangle){
triArray.push(_arg1);
}
public function getDownDelta():Array{
var _local1:Array;
_local1 = new Array(0, 0);
switch (orientation){
case "12":
_local1[0] = -2;
_local1[1] = 0;
break;
case "10":
_local1[0] = -1;
_local1[1] = 1;
break;
case "8":
_local1[0] = 1;
_local1[1] = 1;
break;
case "6":
_local1[0] = 2;
_local1[1] = 0;
break;
case "4":
_local1[0] = 1;
_local1[1] = -1;
break;
case "2":
_local1[0] = -1;
_local1[1] = -1;
break;
};
return (_local1);
}
public function getRowColPos(_arg1:int, _arg2:int):Array{
var _local3:Array;
var _local4:Number;
var _local5:Number;
var _local6:*;
var _local7:*;
var _local8:String;
var _local9:int;
var _local10:int;
_local3 = new Array(3);
_arg1 = (_arg1 + stagger);
if ((_arg1 % 2) == 0){
startX = tx0;
offsetX = tx0;
} else {
startX = (root3over6 * side);
offsetX = tx1;
};
_local4 = (startY + (-(ty) * _arg1));
_local5 = 0;
if ((_arg2 % 2) == 0){
_local5 = (startX + (_arg2 * spaceW));
} else {
_local5 = ((startX + offsetX) + ((_arg2 - 1) * spaceW));
};
_local6 = (_local5 + (boardRadius * (1 - (Math.sqrt(3) / 2))));
_local7 = (_local4 - boardRadius);
_local3[0] = _local6;
_local3[1] = _local7;
_local8 = "";
_local9 = (_arg1 - stagger);
_local10 = _arg2;
if (stagger == 0){
if (((((((_local9 % 2) == 0)) && (((_local10 % 2) == 0)))) || ((((Math.abs((_local9 % 2)) == 1)) && ((Math.abs((_local10 % 2)) == 1)))))){
_local8 = "left";
} else {
if ((((((Math.abs((_local9 % 2)) == 1)) && (((_local10 % 2) == 0)))) || (((((_local9 % 2) == 0)) && ((Math.abs((_local10 % 2)) == 1)))))){
_local8 = "right";
};
};
} else {
if (((((((_local9 % 2) == 0)) && (((_local10 % 2) == 0)))) || ((((Math.abs((_local9 % 2)) == 1)) && ((Math.abs((_local10 % 2)) == 1)))))){
_local8 = "right";
} else {
if ((((((Math.abs((_local9 % 2)) == 1)) && (((_local10 % 2) == 0)))) || (((((_local9 % 2) == 0)) && ((Math.abs((_local10 % 2)) == 1)))))){
_local8 = "left";
};
};
};
_local3[2] = _local8;
return (_local3);
}
public function removeTri(_arg1:GameTriangle):void{
if (_arg1.parent == triLayer){
triLayer.removeChild(_arg1);
} else {
trace("errant call to remove shape!!!!!!!!!!!!!!!!!!!!!");
};
}
public function getOrientation():String{
return (orientation);
}
public function rebuildTriArray(){
var _local1:int;
var _local2:int;
triArray = new Array();
_local1 = 0;
while (_local1 < boardHeight) {
_local2 = 0;
while (_local2 < boardWidth) {
if (gameSpaces[_local1][_local2].getState() == "tri"){
triArray.push(GameSpace(gameSpaces[_local1][_local2]).getTriangle());
};
_local2++;
};
_local1++;
};
}
public function addTestTris(_arg1:int){
var _local2:int;
var _local3:int;
var _local4:GameTriangle;
var _local5:*;
_local2 = 0;
while (_local2 < (boardHeight / 2)) {
_local3 = 0;
while (_local3 < (boardWidth / 2)) {
if (getSpaceState(_local2, _local3) == "empty"){
_local4 = new GameTriangle();
_local4.setColor(_arg1);
_local4.setCol(_local2);
_local4.setRow(_local3);
_local5 = getGameSpace(_local2, _local3);
_local5.setStateTri(_local4);
addTri(_local4);
};
_local3++;
};
_local2++;
};
}
public function setInitialTris(_arg1:Array){
var _local2:int;
var _local3:GameTriangle;
var _local4:GameSpace;
_local2 = 0;
while (_local2 < _arg1.length) {
_local3 = GameTriangle(_arg1[_local2]);
_local3.scaleX = ((boardRadius / gameSegs) / 100);
_local3.scaleY = ((boardRadius / gameSegs) / 100);
triLayer.addChild(_local3);
addTriToArray(_local3);
_local4 = getGameSpace(_local3.getRow(), _local3.getCol());
_local4.setStateTri(_local3);
_local2++;
};
}
public function addPiece(_arg1:GamePiece):void{
triLayer.addChild(_arg1);
}
public function removePiece(_arg1:GamePiece):void{
if (_arg1.parent == triLayer){
triLayer.removeChild(_arg1);
} else {
trace("errant call to remove shape!!!!!!!!!!!!!!!!!!!!!");
};
}
public function getGameSpace(_arg1:int, _arg2:int):GameSpace{
return (GameSpace(gameSpaces[_arg1][_arg2]));
}
}
}//package GameElements
Section 3
//GameLevel (GameElements.GameLevel)
package GameElements {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.media.*;
import flash.text.*;
import flash.utils.*;
import flash.ui.*;
public class GameLevel extends MovieClip {
private var gameColors:Array;
private var hasDoomsDay:Boolean;// = false
private var blueBarOld:Number;// = 0
private var WHITE:int;// = 0xFFFFFF
private var numShapes:TextField;
private var gameBoard:GameBoard;
private var gamePiece:GamePiece;
private var animReactInit:Boolean;// = false
private var endReaction:Boolean;// = false
private var thisFrameRotation:Number;// = 0
private var fadeToWhite:FadeToWhite;
private var winlevels:Sound;
private var shapeCombo:int;// = 0
private var nextPieceLayer:MovieClip;
private var boardBoarder:Border;
private var gameTimer:Timer;
private var rotateOK:Boolean;// = true
private var CW:Boolean;
private var titlePause:TitlePause;
private var redBarNew:Number;// = 0
private var radius:int;// = 0
private var score:Number;// = 0
private var reactionTimer:DifferenceTimer;
private var volumeSFXT:SoundTransform;
private var reactionMask;
private var redBarTimer:DifferenceTimer;
private var glowRays:GlowRays;
private var boardSegs:int;// = 0
private var tumbleTimer:TextField;
private var levelBG:LevelBackground;
private var scoringArray:Array;
private var tumbleComboText:TextField;
private var numTris:TextField;
private var pauseButton:SimpleButton;
private var thuds:Sound;
private var levelText:TextField;
private var cycleTime:int;
private var comboPointsText:TextField;
private var scoreText:TextField;
private var btwFract:Number;// = 0.39
private var gEmit:ParticleEmiter;
private var sEmit:ParticleEmiter;
private var reactionInd;
private var tumbleCombo:int;// = 0
private var reactionIndicatorTimer:DifferenceTimer;
private var volumeSFX:Number;
private var redBarOld:Number;// = 0
private var wheelturns:Sound;
private var numberTris:int;// = 0
private var gameoverTimer:Timer;
private var maingame:DeltaFusion;
private var paused:Boolean;// = false
private var boardRotationTimer:DifferenceTimer;
private var shapeComboText:TextField;
private var jEmit:ParticleEmiter;
private var shapeArrayLeft:Array;
private var blueBar:BlueBar;
private var nativeScale:int;// = 450
private var level:int;// = 0
private var blueBarNew:Number;// = 0
private var blueBarTimer:DifferenceTimer;
private var fEmit:ParticleEmiter;
private var numberShapes:int;// = 0
private var maxTris:int;// = 0
private var nextPiece:GamePiece;
private var maskLayer:MovieClip;
private var redBar:RedBar;
private var redBarNow:Number;// = 0
private var table:MovieClip;
private var shapeArrayRight:Array;
private var gameState:String;// = "anim score"
private var frameTime:int;// = 0
private var futuristicbuzzs:Sound;
private var destroypieces:Sound;
private var targetShapes:int;// = 0
private var BLACK:int;// = 0xFF00AA
private var nextFrameRotation:Number;// = 0
private var cycleTimer:DifferenceTimer;
public function GameLevel(_arg1:DeltaFusion, _arg2:int, _arg3:int, _arg4:Array, _arg5:String, _arg6:int, _arg7:Array, _arg8:int, _arg9:String, _arg10:int, _arg11:Number){
var _local12:ParticleNewLevel;
boardSegs = 0;
nativeScale = 450;
btwFract = 0.39;
radius = 0;
boardBoarder = new Border();
levelBG = new LevelBackground();
glowRays = new GlowRays();
table = new MovieClip();
nextPieceLayer = new MovieClip();
maskLayer = new MovieClip();
pauseButton = new SimpleButton();
gameState = "anim score";
WHITE = 0xFFFFFF;
BLACK = 0xFF00AA;
paused = false;
shapeArrayRight = new Array(GameShape(new ShapeTriangleRight()));
shapeArrayLeft = new Array(GameShape(new ShapeTriangleLeft()), GameShape(new ShapeHexagonLeft()));
level = 0;
shapeCombo = 0;
tumbleCombo = 0;
targetShapes = 0;
numberShapes = 0;
numberTris = 0;
maxTris = 0;
score = 0;
frameTime = 0;
boardRotationTimer = new DifferenceTimer(333);
cycleTimer = new DifferenceTimer(cycleTime);
reactionTimer = new DifferenceTimer(5000);
reactionIndicatorTimer = new DifferenceTimer(800);
blueBarTimer = new DifferenceTimer(800);
redBarTimer = new DifferenceTimer(800);
redBarOld = 0;
redBarNow = 0;
redBarNew = 0;
blueBarOld = 0;
blueBarNew = 0;
reactionInd = new ReactionIndicator();
reactionMask = new ReactorMask();
hasDoomsDay = false;
animReactInit = false;
nextFrameRotation = 0;
thisFrameRotation = 0;
rotateOK = true;
endReaction = false;
destroypieces = Sound(new destroypiecesound());
futuristicbuzzs = Sound(new futuristicbuzzsound());
thuds = Sound(new thudsound());
wheelturns = Sound(new wheelturnsound());
winlevels = Sound(new winlevelsound());
super();
volumeSFX = _arg11;
volumeSFXT = new SoundTransform(volumeSFX, 0);
playSFX("winlevel");
focusRect = false;
score = Number(_arg8);
maingame = _arg1;
cycleTime = _arg3;
gameColors = _arg4;
targetShapes = _arg6;
tumbleCombo = _arg10;
boardSegs = _arg2;
level = maingame.getLevelNumber();
maxTris = ((boardSegs * boardSegs) * 3);
radius = (nativeScale * btwFract);
gameBoard = new GameBoard(boardSegs, _arg4, radius);
gameBoard.setInitialTris(_arg7);
table.rotation = getOrientationAngle(_arg9);
gameBoard.setOrientation(_arg9);
thisFrameRotation = table.rotation;
nextFrameRotation = getOrientationAngle(_arg9);
reactionInd = new ReactionIndicator();
reactionMask = ReactorMask(reactionInd.getChildByName("_mask"));
if (_arg10 >= 1){
GSF_TumbleStart_NextLevel();
} else {
GSF_TumbleStart_NewGame();
};
gameBoard.x = -(radius);
reactionInd.x = radius;
gameBoard.addChild(reactionInd);
table.addChild(gameBoard);
table.addChild(boardBoarder);
redBar = RedBar(levelBG.getChildByName("_redBar"));
blueBar = BlueBar(levelBG.getChildByName("_blueBar"));
addChild(levelBG);
nextPieceLayer.x = 123;
nextPieceLayer.y = -197;
levelBG.addChild(nextPieceLayer);
jEmit = new ParticleEmiter((radius * 1.1), 0, "Jet", "circle");
addChild(jEmit);
fEmit = new ParticleEmiter((radius * 1.1), 25, "Fire", "circle");
addChild(fEmit);
gEmit = new ParticleEmiter((radius * 1.1), 100, "Glow", "circle");
addChild(gEmit);
addChild(table);
addChild(glowRays);
sEmit = new ParticleEmiter((radius * 1.1), 200, "Steam", "semi-cricle");
sEmit.y = 20;
addChild(sEmit);
gameTimer = new Timer((cycleTime / 2), 0);
gameTimer.addEventListener(TimerEvent.TIMER, gameCycle);
gameTimer.start();
maingame.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown);
maingame.addEventListener(KeyboardEvent.KEY_UP, onKeyUp);
maingame.addEventListener(Event.ENTER_FRAME, onEnterFrame);
cycleTimer = new DifferenceTimer(cycleTime);
setHeadsUpDisplay();
titlePause = new TitlePause(maingame);
pauseButton = SimpleButton(levelBG.getChildByName("_pauseButton"));
pauseButton.addEventListener(MouseEvent.CLICK, pauseClicked);
titlePause.x = -((nativeScale / 2));
titlePause.y = -((nativeScale / 2));
_local12 = new ParticleNewLevel(this, 0, 0, 0, 0);
_local12.setLevel(maingame.getLevelNumber());
glowRays.alpha = 1;
if (maingame.getLevelNumber() == 1){
glowRays.alpha = 0;
};
nextPieceLayer.scaleX = (boardSegs / 8);
nextPieceLayer.scaleY = (boardSegs / 8);
visualizeNextPiece(createPiece());
}
private function visualizeNextPiece(_arg1:GamePiece):void{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Array;
var _local7:Array;
var _local8:int;
var _local9:Array;
nextPiece = _arg1;
_local2 = 0;
_local3 = 0;
_local4 = 0;
_local5 = 0;
switch (gameBoard.getOrientation()){
case "12":
case "6":
_arg1.setRotation("None");
break;
case "2":
case "8":
_arg1.setRotation("CCW");
break;
case "10":
case "4":
_arg1.setRotation("CW");
break;
};
_local6 = gameBoard.getStartPos(_arg1.getDirection());
_arg1.setStartPos(_local6[0]);
_arg1.updateTriArray();
_local7 = _arg1.getTriArray();
_local8 = 0;
while (_local8 < _local7.length) {
_local9 = gameBoard.getRowColPos(_local7[_local8].getRow(), _local7[_local8].getCol());
_local7[_local8].setDirection(_local9[2]);
_local7[_local8].x = _local9[0];
_local7[_local8].y = _local9[1];
_local2 = (_local2 + _local7[_local8].x);
_local3 = (_local3 + _local7[_local8].y);
_local8++;
};
_local4 = (_local2 / _local7.length);
_local5 = (_local3 / _local7.length);
_local8 = 0;
while (_local8 < _local7.length) {
_local7[_local8].x = (_local7[_local8].x - _local4);
_local7[_local8].y = (_local7[_local8].y - _local5);
_local8++;
};
_local8 = 0;
while (_local8 < nextPieceLayer.numChildren) {
if (nextPieceLayer.getChildAt(_local8) != null){
nextPieceLayer.removeChildAt(_local8);
};
_local8++;
};
nextPieceLayer.addChild(_arg1);
}
private function buildComboTris(_arg1:Array){
var _local2:int;
var _local3:GameTriangle;
var _local4:GameSpace;
_local2 = 0;
while (_local2 < _arg1.length) {
if (_arg1[_local2][2] >= 2){
_local3 = new GameTriangle();
_local3.setColor(WHITE);
_local3.setCol(_arg1[_local2][0]);
_local3.setRow(_arg1[_local2][1]);
_local4 = gameBoard.getGameSpace(_arg1[_local2][0], _arg1[_local2][1]);
_local4.setStateTri(_local3);
gameBoard.addTri(_local3);
_local3.scaleX = ((radius / boardSegs) / 100);
_local3.scaleY = ((radius / boardSegs) / 100);
};
_local2++;
};
}
private function GSF_TumbleStart_NewGame(){
reactionMask.scaleX = 0;
reactionMask.scaleY = 0;
rotateOK = false;
endReaction = true;
}
private function checkShapeInit():Boolean{
var _local1:Array;
var _local2:Boolean;
var _local3:int;
_local1 = gamePiece.getTriArray();
_local2 = true;
_local3 = 0;
while (_local3 < _local1.length) {
switch (gameBoard.getSpaceState(_local1[_local3].getRow(), _local1[_local3].getCol())){
case "out of bounds":
_local2 = false;
break;
case "empty":
break;
case "tri":
gameState = "game over";
gameOver();
_local3 = _local1.length;
_local2 = false;
return (_local2);
};
_local3++;
};
if (_local2){
};
return (_local2);
}
public function gameCycle(_arg1:Event){
var _local2:Array;
cycleTimer.start();
switch (gameState){
case "next piece ready":
realizePiece(nextPiece);
visualizeNextPiece(createPiece());
gameState = "piece init";
return;
case "piece init":
_local2 = gameBoard.getDownDelta();
gamePiece.updateCoords(_local2);
clearLastFrame();
updateShapeSpaces();
if (checkShapeInit()){
gameState = "piece falling";
};
break;
case "piece falling":
_local2 = gameBoard.getDownDelta();
gamePiece.updateCoords(_local2);
clearLastFrame();
updateShapeSpaces();
break;
case "piece break":
tumbleTris();
break;
case "tumbling":
tumbleTris();
break;
case "scoring":
checkScore();
applyScoring();
break;
case "anim score":
gameState = "tumbling";
break;
};
updateGUI();
}
private function shapeToTris(){
var _local1:Array;
var _local2:Array;
var _local3:int;
var _local4:String;
var _local5:GameSpace;
var _local6:GameTriangle;
gameState = "piece break";
playSFX("break");
gameTimer.delay = (cycleTime / 2);
clearThisFrame();
_local1 = gamePiece.getTriCoordsLast();
_local2 = gamePiece.getTriArray();
_local3 = 0;
while (_local3 < 4) {
_local4 = gameBoard.getSpaceState(_local1[_local3][0], _local1[_local3][1]);
switch (_local4){
case "shape":
case "empty":
_local5 = gameBoard.getGameSpace(_local1[_local3][0], _local1[_local3][1]);
_local6 = GameTriangle(_local2[_local3]);
_local6.setCol(_local1[_local3][1]);
_local6.setRow(_local1[_local3][0]);
_local6.setDirection(_local5.getDirection());
_local5.setStateTri(_local6);
gameBoard.addTri(_local2[_local3]);
break;
};
_local3++;
};
cleanUpPiece();
}
public function updateTriDisplay(_arg1:int){
var _local2:Number;
if (_arg1 != numberTris){
redBarOld = redBarNow;
numberTris = _arg1;
redBarNew = (numberTris / maxTris);
redBarTimer.start();
};
_local2 = (numberTris / maxTris);
if (gameState != "tumbling"){
if (_local2 < 0.25){
fEmit.rate = 0;
jEmit.rate = 0;
} else {
if ((((_local2 >= 0.25)) && ((_local2 < 0.5)))){
fEmit.rate = ((_local2 - 0.25) * 15);
jEmit.rate = 0;
} else {
if ((((_local2 >= 0.5)) && ((_local2 < 0.75)))){
fEmit.rate = ((_local2 - 0.75) * -15);
jEmit.rate = ((_local2 - 0.5) * 15);
} else {
if (_local2 >= 0.75){
fEmit.rate = 15;
jEmit.rate = 15;
};
};
};
};
} else {
fEmit.rate = 0;
};
}
private function getOrientationAngle(_arg1:String):int{
var _local2:int;
_local2 = 0;
switch (_arg1){
case "12":
_local2 = 0;
break;
case "2":
_local2 = 300;
break;
case "4":
_local2 = 240;
break;
case "6":
_local2 = 180;
break;
case "8":
_local2 = 120;
break;
case "10":
_local2 = 60;
break;
};
return (_local2);
}
private function checkScore():void{
var _local1:int;
var _local2:Array;
var _local3:Boolean;
var _local4:int;
var _local5:int;
var _local6:Array;
var _local7:ScoringEvent;
var _local8:GameSpace;
var _local9:Point;
var _local10:Shrapnel;
var _local11:ParticleHex;
var _local12:ParticleTri;
var _local13:ParticleHex;
var _local14:ParticleTri;
scoringArray = new Array();
_local1 = 0;
_local2 = gameBoard.getTriArray();
_local3 = false;
if ((((_local2.length == 0)) && (!((maingame.getLevelNumber() == 1))))){
trace("ALL CLEAR WooHoo!");
};
_local4 = 0;
while (_local4 < _local2.length) {
switch (_local2[_local4].getDirection()){
case "right":
_local5 = 0;
while (_local5 < shapeArrayRight.length) {
_local6 = shapeArrayRight[_local5].getShapeOffsets(_local2[_local4].getRow(), _local2[_local4].getCol());
if (checkScoreShape(_local2[_local4], _local6)){
_local7 = new ScoringEvent(shapeArrayRight[_local5].getPoints(), getQualifiedClassName(shapeArrayRight[_local5]), _local6, tumbleCombo);
scoringArray.push(_local7);
_local3 = true;
_local8 = gameBoard.getGameSpace(_local2[_local4].getRow(), _local2[_local4].getCol());
_local9 = getScoreShapeCenter(_local2[_local4], _local6);
if (getQualifiedClassName(shapeArrayRight[_local5]) == "GameElements::ShapeHexagonRight"){
_local11 = new ParticleHex(table, (_local9.x - radius), _local9.y, 0, 0);
_local11.scaleX = ((radius / boardSegs) / 100);
_local11.scaleY = ((radius / boardSegs) / 100);
};
if (getQualifiedClassName(shapeArrayRight[_local5]) == "GameElements::ShapeTriangleRight"){
_local12 = new ParticleTri(table, (_local9.x - radius), _local9.y, 0, 0);
_local12.scaleX = ((radius / boardSegs) / 100);
_local12.scaleY = ((radius / boardSegs) / 100);
};
startReactionAnim((_local9.x - radius), _local9.y);
_local10 = new Shrapnel(table, (_local9.x - radius), _local9.y);
};
_local5++;
};
break;
case "left":
_local5 = 0;
while (_local5 < shapeArrayLeft.length) {
_local6 = shapeArrayLeft[_local5].getShapeOffsets(_local2[_local4].getRow(), _local2[_local4].getCol());
if (checkScoreShape(_local2[_local4], _local6)){
_local7 = new ScoringEvent(shapeArrayLeft[_local5].getPoints(), getQualifiedClassName(shapeArrayLeft[_local5]), _local6, tumbleCombo);
_local3 = true;
_local8 = gameBoard.getGameSpace(_local2[_local4].getRow(), _local2[_local4].getCol());
_local9 = getScoreShapeCenter(_local2[_local4], _local6);
if (getQualifiedClassName(shapeArrayLeft[_local5]) == "GameElements::ShapeHexagonLeft"){
scoringArray.push(_local7);
_local13 = new ParticleHex(table, (_local9.x - radius), _local9.y, 0, 0);
_local13.scaleX = ((radius / boardSegs) / -100);
_local13.scaleY = ((radius / boardSegs) / 100);
};
if (getQualifiedClassName(shapeArrayLeft[_local5]) == "GameElements::ShapeTriangleLeft"){
scoringArray.push(_local7);
_local14 = new ParticleTri(table, (_local9.x - radius), _local9.y, 0, 0);
_local14.scaleX = ((radius / boardSegs) / -100);
_local14.scaleY = ((radius / boardSegs) / 100);
};
if (getQualifiedClassName(shapeArrayLeft[_local5]) == "GameElements::ShapeBlackHoleLeft"){
hasDoomsDay = true;
};
startReactionAnim((_local9.x - radius), _local9.y);
_local10 = new Shrapnel(table, (_local9.x - radius), _local9.y);
};
_local5++;
};
break;
};
_local4++;
};
shapeCombo = scoringArray.length;
_local4 = 0;
while (_local4 < scoringArray.length) {
_local7 = ScoringEvent(scoringArray[_local4]);
_local7.shapeCombo = shapeCombo;
_local4++;
};
if (!_local3){
tumbleCombo = 0;
gameTimer.delay = cycleTime;
animReactInit = false;
reactionMask.scaleX = 0;
reactionMask.scaleY = 0;
gEmit.rate = 0;
glowRays.alpha = 0;
endReaction = false;
gameState = "next piece ready";
tumbleTimer.text = "NO REACTION";
hasDoomsDay = false;
if (numberTris > maxTris){
this.gameOver();
};
} else {
gameState = "tumbling";
gEmit.rate = 25;
};
_local4 = 0;
while (_local4 < scoringArray.length) {
_local7 = ScoringEvent(scoringArray[_local4]);
_local7.shapeCombo = scoringArray.length;
_local7.tumbleCombo = tumbleCombo;
_local4++;
};
}
private function cleanUpPiece(){
gameBoard.removePiece(gamePiece);
}
private function tumbleTris():void{
var _local1:Array;
var _local2:Boolean;
var _local3:int;
_local1 = gameBoard.getTriArray();
updateTriDisplay(_local1.length);
_local2 = false;
_local3 = 0;
while (_local3 < _local1.length) {
if (gameBoard.tumbleTri(_local1[_local3])){
_local2 = true;
};
_local3++;
};
if (!_local2){
gameState = "scoring";
};
}
public function updateShapeSpaces(){
var _local1:Array;
var _local2:int;
var _local3:GameTriangle;
var _local4:String;
var _local5:GameSpace;
var _local6:Array;
_local1 = gamePiece.getTriArray();
_local2 = 0;
while (_local2 < 4) {
_local3 = GameTriangle(_local1[_local2]);
_local4 = gameBoard.getSpaceState(_local3.getRow(), _local3.getCol());
switch (_local4){
case "empty":
_local5 = gameBoard.getGameSpace(_local3.getRow(), _local3.getCol());
_local5.setStateShape(_local3);
break;
case "out of bounds":
if (gameState == "piece init"){
_local6 = gameBoard.getRowColPos(_local3.getRow(), _local3.getCol());
_local3.x = _local6[0];
_local3.y = _local6[1];
} else {
shapeToTris();
_local2 = 4;
};
break;
case "tri":
shapeToTris();
_local2 = 4;
break;
};
_local2++;
};
}
private function playSFX(_arg1:String){
switch (_arg1){
case "turn":
wheelturns.play(0, 1, volumeSFXT);
break;
case "thud":
thuds.play(0, 1, volumeSFXT);
break;
case "break":
futuristicbuzzs.play(0, 1, volumeSFXT);
break;
case "destroypiece":
destroypieces.play(0, 1, volumeSFXT);
break;
case "winlevel":
winlevels.play(0, 1, volumeSFXT);
break;
};
}
public function onKeyUp(_arg1:KeyboardEvent):void{
switch (_arg1.keyCode){
case Keyboard.LEFT:
case Keyboard.RIGHT:
rotateOK = true;
};
}
public function onEnterFrame(_arg1:Event){
maingame.stage.focus = this;
if (!paused){
updateParticles();
animateReactionTimer();
animateColorBars();
animationReactionInd();
animateBoardRotation();
if (((maxTris - numberTris) < 24)){
shake(table, 1);
shake(levelBG, 0.5);
} else {
if (((maxTris - numberTris) < 18)){
shake(table, 2);
shake(levelBG, 1);
} else {
if (((maxTris - numberTris) < 12)){
shake(table, 6);
shake(levelBG, 3);
};
};
};
};
frameTime = getTimer();
}
public function cleanUp():void{
maingame.removeEventListener(Event.ENTER_FRAME, onEnterFrame);
gameTimer.removeEventListener(TimerEvent.TIMER, gameCycle);
maingame.removeEventListener(KeyboardEvent.KEY_DOWN, onKeyDown);
maingame.removeEventListener(KeyboardEvent.KEY_UP, onKeyUp);
pauseButton.removeEventListener(MouseEvent.CLICK, pauseClicked);
titlePause.cleanup();
}
private function animationReactionInd(){
var _local1:*;
_local1 = reactionIndicatorTimer.getFract();
if (animReactInit){
if (_local1 < 1){
reactionMask.scaleX = (_local1 * 1.5);
reactionMask.scaleY = (_local1 * 1.5);
} else {
_local1 = 1;
};
};
}
public function clearLastFrame(){
var _local1:Array;
var _local2:int;
var _local3:GameSpace;
_local1 = gamePiece.getTriCoordsLast();
_local2 = 0;
while (_local2 < 4) {
switch (gameBoard.getSpaceState(_local1[_local2][0], _local1[_local2][1])){
case "shape":
_local3 = gameBoard.getGameSpace(_local1[_local2][0], _local1[_local2][1]);
_local3.setState("empty");
break;
};
_local2++;
};
}
public function onKeyDown(_arg1:KeyboardEvent):void{
var _local2:String;
if (_arg1.keyCode == 32){
if (!paused){
pause();
} else {
unpause();
};
};
if (!paused){
switch (gameState){
case "piece break":
case "piece init":
case "next piece ready":
switch (_arg1.keyCode){
case Keyboard.LEFT:
case Keyboard.RIGHT:
playSFX("thud");
break;
};
break;
case "piece falling":
case "tumbling":
case "anim score":
switch (_arg1.keyCode){
case Keyboard.LEFT:
CW = false;
if (((rotateOK) && (!(endReaction)))){
rotateOK = false;
playSFX("turn");
switch (gameBoard.getOrientation()){
case "12":
_local2 = "2";
break;
case "2":
_local2 = "4";
break;
case "4":
_local2 = "6";
break;
case "6":
_local2 = "8";
break;
case "8":
_local2 = "10";
break;
case "10":
_local2 = "12";
break;
};
} else {
_local2 = gameBoard.getOrientation();
playSFX("thud");
};
setBoardOrientation(_local2);
break;
case Keyboard.RIGHT:
CW = true;
if (((rotateOK) && (!(endReaction)))){
playSFX("turn");
rotateOK = false;
switch (gameBoard.getOrientation()){
case "12":
_local2 = "10";
break;
case "10":
_local2 = "8";
break;
case "8":
_local2 = "6";
break;
case "6":
_local2 = "4";
break;
case "4":
_local2 = "2";
break;
case "2":
_local2 = "12";
break;
};
} else {
_local2 = gameBoard.getOrientation();
playSFX("thud");
};
setBoardOrientation(_local2);
break;
case Keyboard.UP:
switch (gamePiece.getRotation()){
case "None":
gamePiece.setRotation("CCW");
setInstantPieceOrientation();
break;
case "CCW":
gamePiece.setRotation("CW");
setInstantPieceOrientation();
break;
case "CW":
gamePiece.setRotation("None");
setInstantPieceOrientation();
break;
};
break;
case Keyboard.DOWN:
switch (gamePiece.getRotation()){
case "None":
gamePiece.setRotation("CW");
setInstantPieceOrientation();
break;
case "CW":
gamePiece.setRotation("CCW");
setInstantPieceOrientation();
break;
case "CCW":
gamePiece.setRotation("None");
setInstantPieceOrientation();
break;
};
break;
};
break;
};
};
}
private function animateColorBars(){
var _local1:Number;
var _local2:Number;
_local1 = redBarTimer.getFract();
_local2 = blueBarTimer.getFract();
if (_local1 < 1){
redBarNow = (((1 - _local1) * redBarOld) + (_local1 * redBarNew));
redBar.setCrop((1 - redBarNow));
} else {
redBar.setCrop((1 - redBarNew));
};
if (_local2 < 1){
blueBar.setCrop((1 - (((1 - _local2) * blueBarOld) + (_local2 * blueBarNew))));
} else {
blueBar.setCrop((1 - blueBarNew));
};
}
public function unpause(){
if (paused){
removeChild(titlePause);
boardRotationTimer.unpause();
cycleTimer.unpause();
reactionTimer.unpause();
reactionIndicatorTimer.unpause();
blueBarTimer.unpause();
redBarTimer.unpause();
gameTimer.start();
paused = false;
maingame.unpause();
};
}
private function GSF_TumbleStart_NextLevel(){
reactionMask.scaleX = 2;
reactionMask.scaleY = 2;
rotateOK = true;
endReaction = false;
}
private function shake(_arg1:MovieClip, _arg2:Number):void{
var _local3:Number;
_local3 = ((Math.random() * Math.PI) * 2);
_arg2 = (_arg2 * ((Math.random() * 0.75) + 0.25));
_arg1.x = (Math.cos(_local3) * _arg2);
_arg1.y = (Math.sin(_local3) * _arg2);
}
private function getScoreShapeCenter(_arg1:GameTriangle, _arg2:Array):Point{
var _local3:Point;
var _local4:Number;
var _local5:Number;
var _local6:int;
var _local7:GameSpace;
_local4 = 0;
_local5 = 0;
_local6 = 0;
while (_local6 < _arg2.length) {
_local7 = gameBoard.getGameSpace(_arg2[_local6][0], _arg2[_local6][1]);
_local4 = (_local4 + _local7.x);
_local5 = (_local5 + _local7.y);
_local6++;
};
_local3 = new Point((_local4 / _arg2.length), (_local5 / _arg2.length));
return (_local3);
}
private function animateBoardRotation(){
var _local1:Number;
_local1 = boardRotationTimer.getFract();
if (_local1 <= 1){
if (CW){
if (nextFrameRotation > thisFrameRotation){
table.rotation = ((nextFrameRotation * _local1) + (thisFrameRotation * (1 - _local1)));
} else {
if (nextFrameRotation < thisFrameRotation){
table.rotation = (((nextFrameRotation + 360) * _local1) + (thisFrameRotation * (1 - _local1)));
} else {
if (nextFrameRotation == thisFrameRotation){
table.rotation = nextFrameRotation;
};
};
};
} else {
if (nextFrameRotation > thisFrameRotation){
table.rotation = ((nextFrameRotation * _local1) + ((thisFrameRotation + 360) * (1 - _local1)));
} else {
if (nextFrameRotation < thisFrameRotation){
table.rotation = ((nextFrameRotation * _local1) + (thisFrameRotation * (1 - _local1)));
} else {
if (nextFrameRotation == thisFrameRotation){
table.rotation = nextFrameRotation;
};
};
};
};
} else {
table.rotation = nextFrameRotation;
};
nextPieceLayer.rotation = table.rotation;
}
private function animateReactionTimer(){
var _local1:*;
if (gameState == "tumbling"){
_local1 = reactionTimer.getFract();
glowRays.alpha = (1 - _local1);
gEmit.rate = ((1 - _local1) * 25);
tumbleTimer.text = new String(reactionTimer.getCountdown());
if (_local1 >= 1){
animReactInit = false;
GSF_SettlePieces_Tumble();
};
};
}
private function youWin():void{
trace(level);
trace(maingame.getMaxLevels());
if (level != maingame.getMaxLevels()){
if (!hasDoomsDay){
cleanUp();
maingame.loadNextLevel(gameBoard.getTriArray(), score, gameBoard.getOrientation(), tumbleCombo);
} else {
gameoverTimer = new Timer((cycleTime * 2), 1);
gameoverTimer.addEventListener(TimerEvent.TIMER, endYouWin);
gameoverTimer.start();
fadeToWhite = new FadeToWhite();
addChild(fadeToWhite);
gameState = "youwin";
};
} else {
gameoverTimer = new Timer(5000, 1);
gameoverTimer.addEventListener(TimerEvent.TIMER, endYouWin);
gameoverTimer.start();
fadeToWhite = new FadeToWhite();
addChild(fadeToWhite);
gameState = "youwin";
};
}
private function setInstantPieceOrientation(){
gamePiece.updateTriArray();
clearLastFrame();
updateShapeSpaces();
}
private function clearShape(_arg1:Array){
var _local2:int;
var _local3:*;
var _local4:*;
_local2 = 0;
while (_local2 < _arg1.length) {
switch (gameBoard.getSpaceState(_arg1[_local2][0], _arg1[_local2][1])){
case "tri":
_local3 = gameBoard.getGameSpace(_arg1[_local2][0], _arg1[_local2][1]);
_local4 = _local3.getTriangle();
gameBoard.removeTri(_local4);
_local3.setState("empty");
break;
};
_local2++;
};
gameBoard.rebuildTriArray();
}
public function setHeadsUpDisplay(){
numShapes = TextField(levelBG.getChildByName("_shapes"));
numTris = TextField(levelBG.getChildByName("_tris"));
numTris.text = new String(((numberTris + "/") + maxTris));
scoreText = TextField(levelBG.getChildByName("_scoreText"));
numShapes.text = new String(((numberShapes + "/") + targetShapes));
tumbleComboText = TextField(levelBG.getChildByName("_tumbleCombo"));
levelText = TextField(levelBG.getChildByName("_levelNumber"));
tumbleTimer = TextField(levelBG.getChildByName("_tumbleTimer"));
comboPointsText = TextField(levelBG.getChildByName("_comboPoints"));
comboPointsText.text = "0";
updateTriDisplay(0);
updateGUI();
}
private function checkScoreShape(_arg1:GameTriangle, _arg2:Array):Boolean{
var _local3:int;
var _local4:Boolean;
var _local5:int;
var _local6:int;
var _local7:GameTriangle;
_local3 = _arg1.getColor();
_local4 = true;
_local5 = BLACK;
if ((((_local3 == WHITE)) || ((_local3 == BLACK)))){
_local6 = 0;
while (_local6 < _arg2.length) {
if (gameBoard.getSpaceState(_arg2[_local6][0], _arg2[_local6][1]) == "tri"){
_local7 = gameBoard.getGameSpace(_arg2[_local6][0], _arg2[_local6][1]).getTriangle();
if (((!((_local7.getColor() == WHITE))) && (!((_local7.getColor() == BLACK))))){
if (_local5 == BLACK){
_local5 = _local7.getColor();
} else {
if (_local5 == _local7.getColor()){
} else {
_local4 = false;
};
};
};
} else {
_local4 = false;
};
_local6++;
};
} else {
_local6 = 0;
while (_local6 < _arg2.length) {
if (gameBoard.getSpaceState(_arg2[_local6][0], _arg2[_local6][1]) == "tri"){
_local7 = gameBoard.getGameSpace(_arg2[_local6][0], _arg2[_local6][1]).getTriangle();
if ((((((_local7.getColor() == _local3)) || ((_local7.getColor() == BLACK)))) || ((_local7.getColor() == WHITE)))){
} else {
_local4 = false;
};
} else {
_local4 = false;
};
_local6++;
};
};
return (_local4);
}
private function startReactionAnim(_arg1:Number, _arg2:Number){
if (!animReactInit){
reactionMask.x = _arg1;
reactionMask.y = _arg2;
reactionIndicatorTimer.start();
animReactInit = true;
};
}
private function pauseClicked(_arg1:Event){
if (!paused){
pause();
};
}
public function tumbleTri(_arg1:GameTriangle){
var _local2:*;
var _local3:GameSpace;
var _local4:*;
_local2 = gameBoard.getGameSpace(_arg1.getRow(), _arg1.getCol());
_local4 = gameBoard.getTumbleSpace(_arg1.getRow(), _arg1.getCol(), _local2.getDirection());
_local3 = gameBoard.getGameSpace(_local4[0], _local4[1]);
_local3.setStateTri(_arg1);
_local2.setState("empty");
}
private function compareComboTris(_arg1:Array, _arg2:Array){
var _local3:int;
var _local4:Boolean;
var _local5:int;
var _local6:int;
var _local7:Array;
_local3 = 0;
while (_local3 < _arg1.length) {
_local4 = false;
_local5 = 0;
_local6 = 0;
while (_local6 < _arg2.length) {
if ((((_arg1[_local3][0] == _arg2[_local6][0])) && ((_arg1[_local3][1] == _arg2[_local6][1])))){
_local4 = true;
_arg2[_local6][2] = (_arg2[_local6][2] + 1);
};
_local6++;
};
if (!_local4){
_local7 = new Array(3);
_local7[0] = _arg1[_local3][0];
_local7[1] = _arg1[_local3][1];
_local7[2] = 1;
_arg2.push(_local7);
};
_local3++;
};
}
private function createPiece():GamePiece{
var _local1:int;
var _local2:String;
var _local3:GamePiece;
var _local4:Boolean;
_local1 = (Math.random() * 3);
_local4 = false;
if (Math.random() < 0.5){
_local2 = "right";
} else {
_local2 = "left";
};
switch (_local1){
case 0:
switch (_local2){
case "right":
_local3 = new PieceTriangleLeft();
_local4 = true;
break;
case "left":
_local3 = new PieceTriangleRight();
_local4 = true;
break;
};
break;
case 1:
switch (_local2){
case "right":
_local3 = new PiecePacmanRight();
_local4 = true;
break;
case "left":
_local3 = new PiecePacmanLeft();
_local4 = true;
break;
};
break;
case 2:
switch (_local2){
case "right":
_local3 = new PieceLineRight();
_local4 = true;
break;
case "left":
_local3 = new PieceLineLeft();
_local4 = true;
break;
};
break;
};
if (!_local4){
trace("No FRICKING NEW PIECE No FRICKING NEW PIECE No FRICKING NEW PIECE No FRICKING NEW PIECE");
};
_local3.setColors(gameColors);
_local3.setTriScale((radius / boardSegs));
return (_local3);
}
public function applyScoring(){
var _local1:int;
var _local2:Array;
var _local3:int;
var _local4:ScoringEvent;
_local1 = 0;
if (scoringArray.length >= 1){
_local2 = new Array();
playSFX("destroypiece");
tumbleCombo = (tumbleCombo + 1);
_local3 = 0;
while (_local3 < scoringArray.length) {
_local4 = ScoringEvent(scoringArray[_local3]);
_local4.setShapeCombo(scoringArray.length);
_local1 = (_local1 + _local4.getPoints());
score = (score + _local4.getPoints());
clearShape(_local4.getTriArray());
compareComboTris(_local4.getTriArray(), _local2);
_local3++;
};
buildComboTris(_local2);
gameBoard.rebuildTriArray();
blueBarOld = (numberShapes / targetShapes);
numberShapes = (numberShapes + scoringArray.length);
numShapes.text = new String(((numberShapes + "/") + targetShapes));
blueBarNew = (numberShapes / targetShapes);
blueBarTimer.start();
reactionTimer.start();
glowRays.alpha = 1;
endReaction = false;
if (numberShapes >= targetShapes){
youWin();
return;
};
scoreText.text = new String(score);
gameState = "anim score";
comboPointsText.text = new String(_local1);
};
}
private function animateTriangles(){
switch (gameState){
case "piece falling":
break;
case "tumbling":
case "piece break":
break;
};
}
private function GSF_SettlePieces_Tumble(){
endReaction = true;
gameState = "piece break";
glowRays.alpha = 0;
gEmit.rate = 0;
tumbleTimer.text = new String("no reaction");
reactionMask.scaleX = 0;
reactionMask.scaleY = 0;
}
private function setBoardOrientation(_arg1:String){
nextFrameRotation = getOrientationAngle(_arg1);
boardRotationTimer.start();
if (table.rotation < 0){
thisFrameRotation = (360 + table.rotation);
} else {
thisFrameRotation = table.rotation;
};
gameBoard.setOrientation(_arg1);
}
public function clearThisFrame(){
var _local1:Array;
var _local2:int;
var _local3:GameTriangle;
var _local4:String;
var _local5:GameSpace;
_local1 = gamePiece.getTriArray();
_local2 = 0;
while (_local2 < 4) {
_local3 = GameTriangle(_local1[_local2]);
_local4 = gameBoard.getSpaceState(_local3.getRow(), _local3.getCol());
switch (_local4){
case "shape":
_local5 = gameBoard.getGameSpace(_local3.getRow(), _local3.getCol());
_local5.setState("empty");
break;
};
_local2++;
};
}
public function updateGUI(){
var _local1:Number;
_local1 = (numberShapes / targetShapes);
scoreText.text = new String(score);
tumbleComboText.text = new String(tumbleCombo);
levelText.text = new String(("LV:" + maingame.getLevelNumber()));
numTris.text = new String(((numberTris + "/") + maxTris));
}
private function realizePiece(_arg1:GamePiece):void{
var _local2:Array;
var _local3:Array;
var _local4:int;
var _local5:Array;
trace(gameBoard.getOrientation());
trace(getQualifiedClassName(_arg1));
gameBoard.addPiece(_arg1);
switch (gameBoard.getOrientation()){
case "12":
case "6":
_arg1.setRotation("None");
break;
case "2":
case "8":
_arg1.setRotation("CCW");
break;
case "10":
case "4":
_arg1.setRotation("CW");
break;
};
_local2 = gameBoard.getStartPos(_arg1.getDirection());
_arg1.setStartPos(_local2[0]);
_local3 = _arg1.getTriArray();
_local4 = 0;
while (_local4 < _local3.length) {
_local5 = gameBoard.getRowColPos(_local3[_local4].getRow(), _local3[_local4].getCol());
_local3[_local4].setDirection(_local5[2]);
_local3[_local4].x = _local5[0];
_local3[_local4].y = _local5[1];
_local4++;
};
gamePiece = _arg1;
updateTriDisplay((numberTris + 4));
}
public function setSFXVolume(_arg1:Number){
volumeSFX = _arg1;
volumeSFXT = new SoundTransform(volumeSFX, 0);
}
private function updateParticles(){
jEmit.update();
fEmit.update();
sEmit.update();
gEmit.update();
}
private function endGameOver(_arg1:Event):void{
gameoverTimer.removeEventListener(TimerEvent.TIMER, endGameOver);
cleanUp();
maingame.loadGameOver(score);
}
private function gameOver():void{
gameoverTimer = new Timer(2000, 1);
gameoverTimer.addEventListener(TimerEvent.TIMER, endGameOver);
gameoverTimer.start();
fadeToWhite = new FadeToWhite();
addChild(fadeToWhite);
fEmit.rate = 25;
gameState = "game over";
}
public function frameRate():Number{
var _local1:int;
var _local2:Number;
_local1 = (getTimer() - frameTime);
_local2 = ((1 / _local1) * 1000);
return (_local2);
}
private function endYouWin(_arg1:Event):void{
cleanUp();
maingame.loadNextLevel(gameBoard.getTriArray(), score, gameBoard.getOrientation(), tumbleCombo);
}
public function pause(){
if (!paused){
addChild(titlePause);
boardRotationTimer.pause();
cycleTimer.pause();
reactionTimer.pause();
reactionIndicatorTimer.pause();
blueBarTimer.pause();
redBarTimer.pause();
gameTimer.stop();
paused = true;
maingame.pause();
};
}
}
}//package GameElements
Section 4
//GamePiece (GameElements.GamePiece)
package GameElements {
import flash.display.*;
public class GamePiece extends MovieClip {
protected var centerCol:int;// = 0
protected var triOffsets:Array;
protected var centralGameSpace:GameSpace;
protected var centerRow:int;// = 0
protected var triOffsetsCW:Array;
protected var triArray:Array;
protected var spin:String;// = "None"
protected var direction:String;// = ""
protected var triOffsetsCCW:Array;
protected var triCoordsLast:Array;
public function GamePiece():void{
triArray = new Array(4);
triOffsets = new Array(4);
triOffsetsCW = new Array(4);
triOffsetsCCW = new Array(4);
triCoordsLast = new Array(4);
centerRow = 0;
centerCol = 0;
spin = "None";
direction = "";
super();
createTriangles();
addTriChildren();
}
public function setRotation(_arg1:String):void{
spin = _arg1;
}
public function getTriArray():Array{
return (triArray);
}
public function setStartPos(_arg1:Array){
centerRow = _arg1[0];
centerCol = _arg1[1];
updateTriArray();
updateTriArray();
}
public function getTriCoordsLast():Array{
return (triCoordsLast);
}
public function getRotation():String{
return (spin);
}
public function applyInstantRotation(){
}
public function setDirection(_arg1:String){
direction = _arg1;
}
public function updateTriArray(){
var _local1:int;
triCoordsLast = new Array(4);
_local1 = 0;
while (_local1 < 4) {
triCoordsLast[_local1] = new Array(2);
triCoordsLast[_local1][0] = triArray[_local1].getRow();
triCoordsLast[_local1][1] = triArray[_local1].getCol();
switch (spin){
case "None":
triArray[_local1].setRow((centerRow + triOffsets[_local1][0]));
triArray[_local1].setCol((centerCol + triOffsets[_local1][1]));
break;
case "CCW":
triArray[_local1].setRow((centerRow + triOffsetsCCW[_local1][0]));
triArray[_local1].setCol((centerCol + triOffsetsCCW[_local1][1]));
break;
case "CW":
triArray[_local1].setRow((centerRow + triOffsetsCW[_local1][0]));
triArray[_local1].setCol((centerCol + triOffsetsCW[_local1][1]));
break;
};
_local1++;
};
}
public function updateCoords(_arg1:Array){
centerRow = (centerRow + _arg1[0]);
centerCol = (centerCol + _arg1[1]);
updateTriArray();
}
private function addTriChildren(){
var _local1:int;
_local1 = 0;
while (_local1 < 4) {
addChild(triArray[_local1]);
_local1++;
};
}
private function rotatePiece(){
}
public function getCol():int{
return (centerCol);
}
public function setColors(_arg1:Array){
var _local2:int;
var _local3:int;
var _local4:int;
_local2 = _arg1[new int((Math.random() * _arg1.length))];
_local3 = _arg1[new int((Math.random() * _arg1.length))];
_local4 = 0;
while (_local4 < triArray.length) {
if (Math.random() > 0.5){
triArray[_local4].setColor(_local2);
} else {
triArray[_local4].setColor(_local3);
};
_local4++;
};
}
public function getRow():int{
return (centerRow);
}
public function getDirection():String{
return (direction);
}
public function createTriangles():void{
}
public function setTriScale(_arg1:Number){
var _local2:int;
_local2 = 0;
while (_local2 < triArray.length) {
triArray[_local2].scaleX = (_arg1 / 100);
triArray[_local2].scaleY = (_arg1 / 100);
_local2++;
};
}
}
}//package GameElements
Section 5
//GameShape (GameElements.GameShape)
package GameElements {
public class GameShape {
protected var points:int;// = 0
protected var ShapeOffsets:Array;
public function GameShape():void{
points = 0;
super();
createShape();
}
public function createShape():void{
}
public function getPoints():int{
return (points);
}
public function getShapeOffsets(_arg1:int, _arg2:int):Array{
var _local3:Array;
var _local4:int;
_local3 = new Array(ShapeOffsets.length);
_local4 = 0;
while (_local4 < ShapeOffsets.length) {
_local3[_local4] = new Array((_arg1 + ShapeOffsets[_local4][0]), (_arg2 + ShapeOffsets[_local4][1]));
_local4++;
};
return (_local3);
}
}
}//package GameElements
Section 6
//GameSpace (GameElements.GameSpace)
package GameElements {
import flash.display.*;
public class GameSpace extends MovieClip {
protected var triangle:GameTriangle;
private var gscale:Number;
private var color:int;
private var shapecolor:int;
private var direction;
private var col:int;// = 0
private var state:String;
private var row:int;// = 0
public function GameSpace(_arg1:int, _arg2:int, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Boolean, _arg7:String){
row = 0;
col = 0;
state = new String("empty");
direction = new String("");
super();
x = _arg3;
y = _arg4;
row = _arg1;
col = _arg2;
gscale = _arg5;
direction = _arg7;
run();
}
public function setStateTri(_arg1:GameTriangle){
triangle = _arg1;
setState("tri");
triangle.setRow(row);
triangle.setCol(col);
triangle.setDirection(direction);
triangle.x = x;
triangle.y = y;
}
public function drawFillTriangle(){
graphics.lineStyle(1, color, 1);
if (direction == "left"){
graphics.beginFill(color, 1);
graphics.moveTo((0 - ((gscale * Math.sqrt(3)) / 3)), 0);
graphics.lineTo((0 + ((gscale * Math.sqrt(3)) / 6)), (0 - (gscale / 2)));
graphics.lineTo((0 + ((gscale * Math.sqrt(3)) / 6)), (0 + (gscale / 2)));
graphics.lineTo((0 - ((gscale * Math.sqrt(3)) / 3)), 0);
graphics.endFill();
} else {
if (direction == "right"){
graphics.beginFill(color, 1);
graphics.moveTo((0 + ((gscale * Math.sqrt(3)) / 3)), 0);
graphics.lineTo((0 - ((gscale * Math.sqrt(3)) / 6)), (0 - (gscale / 2)));
graphics.lineTo((0 - ((gscale * Math.sqrt(3)) / 6)), (0 + (gscale / 2)));
graphics.lineTo((0 + ((gscale * Math.sqrt(3)) / 3)), 0);
graphics.endFill();
};
};
}
public function setState(_arg1:String):void{
state = _arg1;
graphics.clear();
run();
}
public function getCol():int{
return (col);
}
public function drawLineTriangle(){
graphics.lineStyle(1, color, 1);
if (direction == "left"){
graphics.moveTo((0 - ((gscale * Math.sqrt(3)) / 3)), 0);
graphics.lineTo((0 + ((gscale * Math.sqrt(3)) / 6)), (0 - (gscale / 2)));
graphics.lineTo((0 + ((gscale * Math.sqrt(3)) / 6)), (0 + (gscale / 2)));
graphics.lineTo((0 - ((gscale * Math.sqrt(3)) / 3)), 0);
} else {
if (direction == "right"){
graphics.moveTo((0 + ((gscale * Math.sqrt(3)) / 3)), 0);
graphics.lineTo((0 - ((gscale * Math.sqrt(3)) / 6)), (0 - (gscale / 2)));
graphics.lineTo((0 - ((gscale * Math.sqrt(3)) / 6)), (0 + (gscale / 2)));
graphics.lineTo((0 + ((gscale * Math.sqrt(3)) / 3)), 0);
};
};
}
public function setStateShape(_arg1:GameTriangle){
shapecolor = _arg1.getColor();
_arg1.setDirection(direction);
_arg1.x = x;
_arg1.y = y;
setState("shape");
}
private function run():void{
switch (state){
case "out of bounds":
break;
case "empty":
break;
case "tri":
break;
case "shape":
break;
};
}
public function getRow():int{
return (row);
}
public function getTriangle():GameTriangle{
return (triangle);
}
public function getDirection():String{
return (direction);
}
public function getState():String{
return (state);
}
}
}//package GameElements
Section 7
//GameTitle (GameElements.GameTitle)
package GameElements {
import flash.events.*;
import flash.display.*;
public class GameTitle extends MovieClip {
private var maingame:DeltaFusion;
private var startButton:SimpleButton;
private var title:Title;
public function GameTitle(_arg1:DeltaFusion){
maingame = _arg1;
title = new Title();
addChild(title);
startButton = SimpleButton(title.getChildByName("_startButton"));
startButton.addEventListener(MouseEvent.CLICK, startPressed);
}
public function loadLevel(){
}
public function startPressed(_arg1:Event){
cleanup();
maingame.startGame();
}
public function cleanup(){
removeEventListener(MouseEvent.CLICK, startPressed);
}
}
}//package GameElements
Section 8
//GameTriangle (GameElements.GameTriangle)
package GameElements {
import flash.display.*;
import flash.geom.*;
public class GameTriangle extends MovieClip {
private var color:int;// = 0
private var ncol:int;// = 0
private var direction;
private var col:int;// = 0
private var displayTri:AtomTri;
private var nrow:int;// = 0
private var row:int;// = 0
public function GameTriangle(){
color = 0;
row = 0;
col = 0;
nrow = 0;
ncol = 0;
displayTri = new AtomTri();
direction = new String("");
super();
}
public function setColor(_arg1:int){
var _local2:int;
var _local3:int;
var _local4:int;
addChild(displayTri);
color = _arg1;
_local2 = ((color >> 16) & 0xFF);
_local3 = ((color >> 8) & 0xFF);
_local4 = (color & 0xFF);
displayTri.transform.colorTransform = new ColorTransform((_local2 / 0x0100), (_local3 / 0x0100), (_local4 / 0x0100), 1, 0, 0, 0, 0);
displayTri.scaleX = 0.8;
displayTri.scaleY = 0.8;
}
public function setDirection(_arg1:String):void{
if (_arg1 == "left"){
rotation = 60;
} else {
rotation = 0;
};
direction = _arg1;
}
public function setRow(_arg1:int){
row = _arg1;
}
public function getCol():int{
return (col);
}
public function getColor():int{
return (color);
}
public function setCol(_arg1:int){
col = _arg1;
}
public function getDirection():String{
return (direction);
}
public function getRow():int{
return (row);
}
}
}//package GameElements
Section 9
//Particle (GameElements.Particle)
package GameElements {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
public class Particle extends MovieClip {
protected var parentClip:MovieClip;
protected var timeLastFrame:int;// = 0
protected var xDelta:Number;
protected var particle:MovieClip;
protected var lifeTimer:Timer;
protected var yDelta:Number;
protected var gl:GameLevel;
protected var lifeTime:Number;// = 2000
public function Particle(_arg1:MovieClip, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number){
lifeTime = 2000;
timeLastFrame = 0;
super();
parentClip = _arg1;
parentClip.addChild(this);
xDelta = _arg4;
yDelta = _arg5;
x = _arg2;
y = _arg3;
defineParticle();
addChild(particle);
lifeTime = ((particle.framesLoaded / 24) * 1000);
lifeTimer = new Timer(lifeTime, 1);
lifeTimer.addEventListener(TimerEvent.TIMER, onGameTimer);
lifeTimer.start();
addEventListener(Event.ENTER_FRAME, onEnterFrame);
timeLastFrame = getTimer();
}
public function onGameTimer(_arg1:Event){
cleanup();
}
public function defineParticle(){
lifeTime = 2000;
}
public function cleanup(){
parentClip.removeChild(this);
lifeTimer.removeEventListener(TimerEvent.TIMER, onGameTimer);
removeEventListener(Event.ENTER_FRAME, onEnterFrame);
}
public function onEnterFrame(_arg1:Event){
var _local2:int;
var _local3:*;
_local2 = getTimer();
_local3 = (_local2 - timeLastFrame);
x = (x + (xDelta * (_local3 / 1000)));
y = (y + (yDelta * (_local3 / 1000)));
timeLastFrame = getTimer();
}
public function setPRotation(_arg1:Number):void{
particle.rotation = (180 - (_arg1 * (180 / Math.PI)));
}
}
}//package GameElements
Section 10
//ParticleEmiter (GameElements.ParticleEmiter)
package GameElements {
import flash.display.*;
import flash.utils.*;
public class ParticleEmiter extends MovieClip {
private var origin:String;// = "circle"
protected var timeLastFrame:int;// = 0
private var xDelta:Number;
private var speed:Number;// = 200
private var radius:int;// = 0
private var type:String;// = "Fire"
private var lifeTimer:Timer;
private var spread:int;// = 5
private var yDelta:Number;
private var angle:Number;// = 0
public var rate:int;// = 0
private var lifeTime:Number;// = 2000
public function ParticleEmiter(_arg1:Number, _arg2:Number, _arg3:String, _arg4:String){
lifeTime = 2000;
rate = 0;
speed = 200;
spread = 5;
timeLastFrame = 0;
radius = 0;
type = "Fire";
origin = "circle";
angle = 0;
super();
radius = _arg1;
type = _arg3;
speed = _arg2;
origin = _arg4;
angle = ((Math.random() * Math.PI) * 2);
timeLastFrame = getTimer();
}
public function update(){
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:ParticleJet;
var _local10:ParticleGlow;
_local1 = (getTimer() - timeLastFrame);
_local2 = ((_local1 / 1000) * rate);
_local3 = Math.random();
switch (origin){
case "circle":
_local4 = (Math.random() * (Math.PI * 2));
_local5 = (Math.sin(_local4) * speed);
_local6 = (Math.cos(_local4) * speed);
_local7 = (Math.sin(_local4) * radius);
_local8 = (Math.cos(_local4) * radius);
break;
case "semi-cricle":
_local4 = ((Math.random() - 0.5) * (Math.PI / 2));
_local5 = 0;
_local6 = ((_local1 / 1000) * speed);
_local7 = (Math.sin(_local4) * radius);
_local8 = (Math.cos(_local4) * radius);
break;
};
if (_local3 < _local2){
switch (type){
case "Fire":
new ParticleFire(this, _local7, _local8, _local5, _local6);
break;
case "Steam":
new ParticleSteam(this, _local7, _local8, _local5, _local6);
break;
case "Jet":
_local9 = new ParticleJet(this, _local7, _local8, _local5, _local6);
_local9.setPRotation(_local4);
break;
case "Glow":
_local10 = new ParticleGlow(this, _local7, _local8, _local5, _local6);
_local10.setPRotation(_local4);
break;
};
};
timeLastFrame = getTimer();
}
}
}//package GameElements
Section 11
//ParticleFire (GameElements.ParticleFire)
package GameElements {
import flash.display.*;
public class ParticleFire extends Particle {
public function ParticleFire(_arg1:MovieClip, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number){
super(_arg1, _arg2, _arg3, _arg4, _arg5);
}
override public function defineParticle(){
particle = MovieClip(new Fire());
particle.scaleX = 2;
particle.scaleY = 2;
rotation = (Math.random() * 360);
}
}
}//package GameElements
Section 12
//ParticleGlow (GameElements.ParticleGlow)
package GameElements {
import flash.display.*;
public class ParticleGlow extends Particle {
public function ParticleGlow(_arg1:MovieClip, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number){
super(_arg1, _arg2, _arg3, _arg4, _arg5);
}
override public function defineParticle(){
particle = MovieClip(new Glow());
particle.scaleX = 2;
particle.scaleY = 2;
}
}
}//package GameElements
Section 13
//ParticleHex (GameElements.ParticleHex)
package GameElements {
import flash.display.*;
public class ParticleHex extends Particle {
public function ParticleHex(_arg1:MovieClip, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number){
super(_arg1, _arg2, _arg3, _arg4, _arg5);
}
override public function defineParticle(){
particle = MovieClip(new HexScoringEvent());
}
}
}//package GameElements
Section 14
//ParticleJet (GameElements.ParticleJet)
package GameElements {
import flash.display.*;
public class ParticleJet extends Particle {
public function ParticleJet(_arg1:MovieClip, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number){
super(_arg1, _arg2, _arg3, _arg4, _arg5);
}
override public function defineParticle(){
particle = MovieClip(new pJet());
particle.scaleX = 1;
particle.scaleY = 1;
}
}
}//package GameElements
Section 15
//ParticleNewLevel (GameElements.ParticleNewLevel)
package GameElements {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
public class ParticleNewLevel extends Particle {
private var levelNum:int;// = 0
protected var timeStart:int;// = 0
public function ParticleNewLevel(_arg1:MovieClip, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number){
levelNum = 0;
timeStart = 0;
super(_arg1, _arg2, _arg3, _arg4, _arg5);
}
override public function defineParticle(){
particle = MovieClip(new NewLevelParticle());
timeStart = getTimer();
scaleX = 0;
scaleY = 0;
}
public function setLevel(_arg1:int){
levelNum = _arg1;
}
override public function onEnterFrame(_arg1:Event){
var _local2:int;
var _local3:*;
var _local4:*;
_local2 = getTimer();
_local3 = (_local2 - timeStart);
_local4 = (_local3 / lifeTime);
if (_local4 < 0.5){
scaleX = (_local4 * 2);
scaleY = (_local4 * 2);
} else {
if ((((_local4 >= 0.5)) && ((_local4 < 1)))){
scaleX = 1;
scaleY = 1;
alpha = (1 - ((_local4 - 0.5) * 2));
} else {
if (_local4 >= 1){
scaleX = 1;
scaleY = 1;
alpha = 0;
};
};
};
NewLevelParticle(particle).setLevel(levelNum);
timeLastFrame = getTimer();
}
}
}//package GameElements
Section 16
//ParticleSteam (GameElements.ParticleSteam)
package GameElements {
import flash.display.*;
public class ParticleSteam extends Particle {
public function ParticleSteam(_arg1:MovieClip, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number){
super(_arg1, _arg2, _arg3, _arg4, _arg5);
}
override public function defineParticle(){
particle = MovieClip(new Steam());
particle.scaleX = 2;
particle.scaleY = 2;
rotation = (Math.random() * 360);
}
}
}//package GameElements
Section 17
//ParticleTri (GameElements.ParticleTri)
package GameElements {
import flash.display.*;
public class ParticleTri extends Particle {
public function ParticleTri(_arg1:MovieClip, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number){
super(_arg1, _arg2, _arg3, _arg4, _arg5);
}
override public function defineParticle(){
particle = MovieClip(new TriScoringEvent());
}
}
}//package GameElements
Section 18
//PieceLineLeft (GameElements.PieceLineLeft)
package GameElements {
public class PieceLineLeft extends GamePiece {
override public function createTriangles():void{
triArray[0] = new GameTriangle();
triArray[1] = new GameTriangle();
triArray[2] = new GameTriangle();
triArray[3] = new GameTriangle();
triOffsets[0] = new Array(0, 0);
triOffsets[1] = new Array(1, 0);
triOffsets[2] = new Array(-1, 0);
triOffsets[3] = new Array(-2, 0);
triOffsetsCCW[0] = new Array(0, 0);
triOffsetsCCW[1] = new Array(-1, 0);
triOffsetsCCW[2] = new Array(0, 1);
triOffsetsCCW[3] = new Array(1, 1);
triOffsetsCW[0] = new Array(0, 0);
triOffsetsCW[1] = new Array(0, 1);
triOffsetsCW[2] = new Array(1, 0);
triOffsetsCW[3] = new Array(1, -1);
graphics.lineStyle(2, 0, 1);
graphics.drawCircle(0, 0, 3);
direction = "left";
}
}
}//package GameElements
Section 19
//PieceLineRight (GameElements.PieceLineRight)
package GameElements {
public class PieceLineRight extends GamePiece {
override public function createTriangles():void{
triArray[0] = new GameTriangle();
triArray[1] = new GameTriangle();
triArray[2] = new GameTriangle();
triArray[3] = new GameTriangle();
triOffsets[0] = new Array(0, 0);
triOffsets[1] = new Array(1, 0);
triOffsets[2] = new Array(-1, 0);
triOffsets[3] = new Array(-2, 0);
triOffsetsCCW[0] = new Array(0, 0);
triOffsetsCCW[1] = new Array(0, -1);
triOffsetsCCW[2] = new Array(1, 0);
triOffsetsCCW[3] = new Array(1, 1);
triOffsetsCW[0] = new Array(0, 0);
triOffsetsCW[1] = new Array(-1, 0);
triOffsetsCW[2] = new Array(0, -1);
triOffsetsCW[3] = new Array(1, -1);
graphics.lineStyle(2, 0, 1);
graphics.drawCircle(0, 0, 3);
direction = "right";
}
}
}//package GameElements
Section 20
//PiecePacmanLeft (GameElements.PiecePacmanLeft)
package GameElements {
public class PiecePacmanLeft extends GamePiece {
override public function createTriangles():void{
triArray[0] = new GameTriangle();
triArray[1] = new GameTriangle();
triArray[2] = new GameTriangle();
triArray[3] = new GameTriangle();
triOffsets[0] = new Array(-1, 0);
triOffsets[1] = new Array(0, 0);
triOffsets[2] = new Array(0, 1);
triOffsets[3] = new Array(-1, 1);
triOffsetsCCW[0] = new Array(-2, 1);
triOffsetsCCW[1] = new Array(-2, 0);
triOffsetsCCW[2] = new Array(-1, 0);
triOffsetsCCW[3] = new Array(0, 0);
triOffsetsCW[0] = new Array(0, 1);
triOffsetsCW[1] = new Array(-1, 1);
triOffsetsCW[2] = new Array(-2, 1);
triOffsetsCW[3] = new Array(-2, 0);
graphics.lineStyle(2, 0, 1);
graphics.drawCircle(0, 0, 3);
direction = "left";
}
}
}//package GameElements
Section 21
//PiecePacmanRight (GameElements.PiecePacmanRight)
package GameElements {
public class PiecePacmanRight extends GamePiece {
override public function createTriangles():void{
triArray[0] = new GameTriangle();
triArray[1] = new GameTriangle();
triArray[2] = new GameTriangle();
triArray[3] = new GameTriangle();
triOffsets[2] = new Array(-1, -1);
triOffsets[1] = new Array(0, -1);
triOffsets[0] = new Array(0, 0);
triOffsets[3] = new Array(-1, 0);
triOffsetsCCW[2] = new Array(-2, 0);
triOffsetsCCW[1] = new Array(-2, -1);
triOffsetsCCW[0] = new Array(-1, -1);
triOffsetsCCW[3] = new Array(0, -1);
triOffsetsCW[2] = new Array(0, 0);
triOffsetsCW[1] = new Array(-1, 0);
triOffsetsCW[0] = new Array(-2, 0);
triOffsetsCW[3] = new Array(-2, -1);
graphics.lineStyle(2, 0, 1);
graphics.drawCircle(0, 0, 3);
direction = "right";
}
}
}//package GameElements
Section 22
//PieceTriangleLeft (GameElements.PieceTriangleLeft)
package GameElements {
public class PieceTriangleLeft extends GamePiece {
override public function createTriangles():void{
triArray[0] = new GameTriangle();
triArray[1] = new GameTriangle();
triArray[2] = new GameTriangle();
triArray[3] = new GameTriangle();
triOffsets[0] = new Array(0, 0);
triOffsets[1] = new Array(-1, 0);
triOffsets[2] = new Array(1, 0);
triOffsets[3] = new Array(0, -1);
triOffsetsCCW[0] = new Array(0, 0);
triOffsetsCCW[1] = new Array(1, 0);
triOffsetsCCW[2] = new Array(0, -1);
triOffsetsCCW[3] = new Array(-1, 0);
triOffsetsCW[0] = new Array(0, 0);
triOffsetsCW[1] = new Array(0, -1);
triOffsetsCW[2] = new Array(-1, 0);
triOffsetsCW[3] = new Array(1, 0);
graphics.lineStyle(2, 0, 1);
graphics.drawCircle(0, 0, 3);
direction = "right";
}
}
}//package GameElements
Section 23
//PieceTriangleRight (GameElements.PieceTriangleRight)
package GameElements {
public class PieceTriangleRight extends GamePiece {
override public function createTriangles():void{
triArray[0] = new GameTriangle();
triArray[1] = new GameTriangle();
triArray[2] = new GameTriangle();
triArray[3] = new GameTriangle();
triOffsets[0] = new Array(0, 0);
triOffsets[1] = new Array(1, 0);
triOffsets[2] = new Array(-1, 0);
triOffsets[3] = new Array(0, 1);
triOffsetsCCW[0] = new Array(0, 0);
triOffsetsCCW[1] = new Array(-1, 0);
triOffsetsCCW[2] = new Array(0, 1);
triOffsetsCCW[3] = new Array(1, 0);
triOffsetsCW[0] = new Array(0, 0);
triOffsetsCW[1] = new Array(0, 1);
triOffsetsCW[2] = new Array(1, 0);
triOffsetsCW[3] = new Array(-1, 0);
graphics.lineStyle(2, 0, 1);
graphics.drawCircle(0, 0, 3);
direction = "left";
}
}
}//package GameElements
Section 24
//ScoringEvent (GameElements.ScoringEvent)
package GameElements {
import flash.display.*;
public class ScoringEvent extends MovieClip {
private var basePoints;// = 0
public var shapeCombo:int;// = 0
private var triArray:Array;
private var shapeType:String;
public var level;// = 1
public var tumbleCombo:int;// = 0
public function ScoringEvent(_arg1:int, _arg2:String, _arg3:Array, _arg4){
shapeCombo = 0;
tumbleCombo = 0;
level = 1;
basePoints = 0;
super();
basePoints = _arg1;
shapeType = _arg2;
triArray = _arg3;
}
public function getTriArray():Array{
return (triArray);
}
public function setShapeCombo(_arg1:int){
shapeCombo = _arg1;
}
public function getPoints():int{
return (((basePoints * shapeCombo) * (tumbleCombo + 1)));
}
}
}//package GameElements
Section 25
//ShapeHexagonLeft (GameElements.ShapeHexagonLeft)
package GameElements {
public class ShapeHexagonLeft extends GameShape {
override public function createShape():void{
ShapeOffsets = new Array(6);
ShapeOffsets[0] = new Array(0, 0);
ShapeOffsets[1] = new Array(1, 0);
ShapeOffsets[2] = new Array(2, 0);
ShapeOffsets[3] = new Array(0, 1);
ShapeOffsets[4] = new Array(1, 1);
ShapeOffsets[5] = new Array(2, 1);
points = 150;
}
}
}//package GameElements
Section 26
//ShapeTriangleLeft (GameElements.ShapeTriangleLeft)
package GameElements {
public class ShapeTriangleLeft extends GameShape {
override public function createShape():void{
ShapeOffsets = new Array(4);
ShapeOffsets[0] = new Array(0, 0);
ShapeOffsets[1] = new Array(-1, 1);
ShapeOffsets[2] = new Array(0, 1);
ShapeOffsets[3] = new Array(1, 1);
points = 100;
}
}
}//package GameElements
Section 27
//ShapeTriangleRight (GameElements.ShapeTriangleRight)
package GameElements {
public class ShapeTriangleRight extends GameShape {
override public function createShape():void{
ShapeOffsets = new Array(4);
ShapeOffsets[0] = new Array(0, 0);
ShapeOffsets[1] = new Array(-1, -1);
ShapeOffsets[2] = new Array(0, -1);
ShapeOffsets[3] = new Array(1, -1);
points = 100;
}
}
}//package GameElements
Section 28
//Shrapnel (GameElements.Shrapnel)
package GameElements {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
public class Shrapnel extends MovieClip {
private var parentClip:MovieClip;
private var frameDelay:int;
private var shrapnel:MovieClip;
private var particlesCreated:int;// = 0
private var frames:int;// = 0
private var particles:Array;
private var exploded:Boolean;// = false
private var numParticles:int;// = 12
private var nextangle:Number;// = 0
private var angle:Number;// = 0
public function Shrapnel(_arg1:MovieClip, _arg2:Number, _arg3:Number):void{
exploded = false;
particles = new Array();
numParticles = 12;
particlesCreated = 0;
frames = 0;
angle = 0;
nextangle = 0;
super();
parentClip = _arg1;
x = _arg2;
y = _arg3;
parentClip.addChild(this);
init();
}
private function init():void{
frameDelay = 20;
addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
private function implode():void{
var _local1:*;
_local1 = 0;
while (_local1 < particles.length) {
particles[_local1].gotoAndPlay("implode");
_local1++;
};
}
private function createShrapnel():void{
var _local1:ScoringParticle;
nextangle = ((Math.random() * 120) - 30);
_local1 = new ScoringParticle();
_local1.rotation = angle;
_local1.scaleX = ((Math.random() * 0.75) + 0.25);
_local1.scaleY = ((Math.random() * 0.75) + 0.25);
addChild(_local1);
particles.push(_local1);
angle = (angle + nextangle);
particlesCreated = (particlesCreated + 1);
}
private function onEnterFrame(_arg1:Event):void{
frames = (frames + 1);
if (particlesCreated < numParticles){
createShrapnel();
} else {
if (frames == (numParticles + 10)){
implode();
} else {
if (frames == (numParticles + frameDelay)){
cleanUp();
};
};
};
}
private function cleanUp():void{
var _local1:*;
_local1 = 0;
while (_local1 < particles.length) {
removeChild(particles[_local1]);
_local1++;
};
frames = 0;
particlesCreated = 0;
removeEventListener(Event.ENTER_FRAME, onEnterFrame);
}
}
}//package GameElements
Section 29
//TitleGameOver (GameElements.TitleGameOver)
package GameElements {
import flash.events.*;
import flash.display.*;
import flash.text.*;
public class TitleGameOver extends MovieClip {
var gameOver1:GameOver1;
var submit:SimpleButton;
var maingame:DeltaFusion;
var reset:SimpleButton;
var score:TextField;
public function TitleGameOver(_arg1:DeltaFusion, _arg2:Number){
maingame = _arg1;
gameOver1 = new GameOver1();
addChild(gameOver1);
reset = SimpleButton(gameOver1.getChildByName("_resetButton"));
submit = SimpleButton(gameOver1.getChildByName("_buttonSubmit"));
score = TextField(gameOver1.getChildByName("_finalScore"));
score.text = new String(_arg2);
reset.addEventListener(MouseEvent.CLICK, resetPressed);
submit.addEventListener(MouseEvent.CLICK, submitPressed);
}
public function cleanup(){
reset.removeEventListener(MouseEvent.CLICK, resetPressed);
submit.removeEventListener(MouseEvent.CLICK, submitPressed);
}
public function resetPressed(_arg1:Event){
cleanup();
maingame.returnToMenuGameOver();
}
public function submitPressed(_arg1:Event){
cleanup();
maingame.goToSubmitGameOver();
}
}
}//package GameElements
Section 30
//TitlePause (GameElements.TitlePause)
package GameElements {
import flash.events.*;
import flash.display.*;
import flash.media.*;
import flash.text.*;
public class TitlePause extends MovieClip {
var bmgVal:Number;
var testSFXSC:SoundChannel;
var maingame:DeltaFusion;
var testSFXST:SoundTransform;
var sfxVal:Number;
var testBMGSC:SoundChannel;
var testBMGST:SoundTransform;
var reset:SimpleButton;
var bmgSlider:VolumeSlider;
var testBMG:Sound;
var score:TextField;
var testSFX:Sound;
var pauseGraphics:TitlePauseGraphic;
var sfxSlider:VolumeSlider;
var gamelevel:GameLevel;
var unpause:SimpleButton;
public function TitlePause(_arg1:DeltaFusion){
testBMG = Sound(new deltaloopmusic());
testSFX = Sound(new wheelturnsound());
testBMGSC = new SoundChannel();
testSFXSC = new SoundChannel();
testBMGST = new SoundTransform(1, 0);
testSFXST = new SoundTransform(1, 0);
super();
maingame = _arg1;
bmgVal = maingame.getBMGVolume();
sfxVal = maingame.getSFXVolume();
testBMGST = new SoundTransform(bmgVal, 0);
testSFXST = new SoundTransform(sfxVal, 0);
pauseGraphics = new TitlePauseGraphic();
bmgSlider = VolumeSlider(pauseGraphics.getChildByName("_bmgSlider"));
bmgSlider.fract = bmgVal;
bmgSlider.addEventListener("DIAL", bmgSlide);
bmgSlider.addEventListener("DIALSTART", bmgSlideS);
bmgSlider.addEventListener("DIALEND", bmgSlideE);
sfxSlider = VolumeSlider(pauseGraphics.getChildByName("_sfxSlider"));
sfxSlider.fract = sfxVal;
sfxSlider.addEventListener("DIAL", sfxSlide);
sfxSlider.addEventListener("DIALSTART", sfxSlideS);
sfxSlider.addEventListener("DIALEND", sfxSlideE);
addChild(pauseGraphics);
reset = SimpleButton(pauseGraphics.getChildByName("_resetButton"));
unpause = SimpleButton(pauseGraphics.getChildByName("_unpauseButton"));
reset.addEventListener(MouseEvent.CLICK, resetPressed);
unpause.addEventListener(MouseEvent.CLICK, unpausePressed);
}
public function sfxSlide(_arg1:Event){
sfxVal = sfxSlider.getFract();
testSFXST = new SoundTransform(sfxVal, 0);
testSFXSC.soundTransform = testSFXST;
maingame.setSFXVolume(sfxVal);
}
public function bmgSlideE(_arg1:Event){
testBMGSC.stop();
}
public function bmgSlideS(_arg1:Event){
testBMGSC = testBMG.play(0, int.MAX_VALUE, testBMGST);
}
public function unpausePressed(_arg1:Event){
cleanup();
maingame.unpause();
}
public function bmgSlide(_arg1:Event){
bmgVal = bmgSlider.getFract();
testBMGST = new SoundTransform(bmgVal, 0);
testBMGSC.soundTransform = testBMGST;
maingame.setBMGVolume(bmgVal);
}
public function sfxSlideS(_arg1:Event){
testSFXSC = testSFX.play(0, int.MAX_VALUE, testSFXST);
}
public function sfxSlideE(_arg1:Event){
testSFXSC.stop();
}
public function cleanup(){
testBMGSC.stop();
testSFXSC.stop();
sfxSlider.removeEventListener("DIAL", sfxSlide);
bmgSlider.removeEventListener("DIAL", bmgSlide);
reset.removeEventListener(MouseEvent.CLICK, resetPressed);
}
public function resetPressed(_arg1:Event){
cleanup();
maingame.unpause();
maingame.returnToMenuPause();
}
}
}//package GameElements
Section 31
//TitleSubmitScore (GameElements.TitleSubmitScore)
package GameElements {
import flash.events.*;
import flash.display.*;
import flash.text.*;
public class TitleSubmitScore extends MovieClip {
var maingame:DeltaFusion;
var nameText:TextField;
var submitButton:SimpleButton;
var resetButton:SimpleButton;
var score:int;// = 0
var hsGraphics:TitleSubmitScoreGraphics;
var scoreText:TextField;
public function TitleSubmitScore(_arg1:DeltaFusion, _arg2:Number, _arg3:String){
hsGraphics = new TitleSubmitScoreGraphics();
score = 0;
super();
addChild(hsGraphics);
score = _arg2;
maingame = _arg1;
scoreText = TextField(hsGraphics.getChildByName("_scoreText"));
scoreText.text = new String(_arg2);
nameText = TextField(hsGraphics.getChildByName("_userText"));
nameText.text = _arg3;
submitButton = SimpleButton(hsGraphics.getChildByName("_buttonSubmit"));
submitButton.addEventListener(MouseEvent.CLICK, onSubmitPressed);
resetButton = SimpleButton(hsGraphics.getChildByName("_resetButton"));
resetButton.addEventListener(MouseEvent.CLICK, onResetPressed);
}
public function onSubmitPressed(_arg1:Event){
maingame.sendHighScore(nameText.text, score);
}
public function onResetPressed(_arg1:Event){
maingame.returnToTitleSubmit();
}
public function cleanup(){
submitButton.removeEventListener(MouseEvent.CLICK, onSubmitPressed);
resetButton.removeEventListener(MouseEvent.CLICK, onResetPressed);
}
}
}//package GameElements
Section 32
//TitleViewHighScores (GameElements.TitleViewHighScores)
package GameElements {
import flash.events.*;
import flash.display.*;
public class TitleViewHighScores extends MovieClip {
var maingame:DeltaFusion;
var resetButton:SimpleButton;
var vsGraphics:TitleViewScoreGraphics;
var sbArray:Array;
public function TitleViewHighScores(_arg1:DeltaFusion, _arg2:Array){
var _local3:int;
var _local4:ScoreBox;
vsGraphics = new TitleViewScoreGraphics();
sbArray = new Array();
super();
_local3 = 0;
while (_local3 < 10) {
_local4 = ScoreBox(vsGraphics.getChildByName(("_sb" + (_local3 + 1))));
_local4.setParameters(_local3, _arg2[_local3][0][1], _arg2[_local3][1][1]);
_local3++;
};
addChild(vsGraphics);
maingame = _arg1;
resetButton = SimpleButton(vsGraphics.getChildByName("_sb"));
resetButton.addEventListener(MouseEvent.CLICK, onResetPressed);
}
public function onResetPressed(_arg1:Event){
maingame.returnToTitleSubmit();
}
public function cleanup(){
resetButton.removeEventListener(MouseEvent.CLICK, onResetPressed);
}
}
}//package GameElements
Section 33
//TitleYouWin (GameElements.TitleYouWin)
package GameElements {
import flash.events.*;
import flash.display.*;
import flash.text.*;
public class TitleYouWin extends MovieClip {
var gameOver1:titleYouWinGraphics;
var submit:SimpleButton;
var maingame:DeltaFusion;
var reset:SimpleButton;
var score:TextField;
var scorenum:int;// = 0
public function TitleYouWin(_arg1:DeltaFusion, _arg2:Number){
scorenum = 0;
super();
maingame = _arg1;
scorenum = _arg2;
gameOver1 = new titleYouWinGraphics();
addChild(gameOver1);
reset = SimpleButton(gameOver1.getChildByName("_resetButton"));
submit = SimpleButton(gameOver1.getChildByName("_buttonSubmit"));
score = TextField(gameOver1.getChildByName("_finalScore"));
score.text = new String(_arg2);
reset.addEventListener(MouseEvent.CLICK, resetPressed);
submit.addEventListener(MouseEvent.CLICK, submitPressed);
}
public function cleanup(){
reset.removeEventListener(MouseEvent.CLICK, resetPressed);
submit.removeEventListener(MouseEvent.CLICK, submitPressed);
}
public function resetPressed(_arg1:Event){
cleanup();
maingame.returnToMenuYouWin();
}
public function submitPressed(_arg1:Event){
cleanup();
maingame.goToSubmitYouWin(scorenum);
}
}
}//package GameElements
Section 34
//LevelParticleGraphic_14 (ScoreBox_fla.LevelParticleGraphic_14)
package ScoreBox_fla {
import flash.display.*;
import flash.text.*;
public dynamic class LevelParticleGraphic_14 extends MovieClip {
public var _lvNum:TextField;
public function LevelParticleGraphic_14(){
addFrameScript(0, frame1);
}
public function setLevelNum(_arg1:int){
_lvNum.text = new String(_arg1);
}
function frame1(){
}
}
}//package ScoreBox_fla
Section 35
//AtomTri (AtomTri)
package {
import flash.display.*;
public dynamic class AtomTri extends MovieClip {
}
}//package
Section 36
//BlueBar (BlueBar)
package {
import flash.display.*;
public dynamic class BlueBar extends MovieClip {
public var _maskLayer:CropPlane;
public function BlueBar(){
addFrameScript(0, frame1);
}
public function setCrop(_arg1:Number){
if (_arg1 == 0){
_maskLayer.y = 0;
} else {
if (_arg1 == 100){
_maskLayer.y = 324;
} else {
_maskLayer.y = ((261 * _arg1) + 17);
};
};
}
function frame1(){
}
}
}//package
Section 37
//Border (Border)
package {
import flash.display.*;
public dynamic class Border extends MovieClip {
}
}//package
Section 38
//buttonSubmit (buttonSubmit)
package {
import flash.display.*;
public dynamic class buttonSubmit extends SimpleButton {
}
}//package
Section 39
//buttonUnpause (buttonUnpause)
package {
import flash.display.*;
public dynamic class buttonUnpause extends SimpleButton {
}
}//package
Section 40
//CropPlane (CropPlane)
package {
import flash.display.*;
public dynamic class CropPlane extends MovieClip {
}
}//package
Section 41
//deltaendloop (deltaendloop)
package {
import flash.media.*;
public dynamic class deltaendloop extends Sound {
}
}//package
Section 42
//DeltaFusion (DeltaFusion)
package {
import flash.events.*;
import flash.display.*;
import GameElements.*;
import flash.media.*;
import flash.system.*;
import flash.net.*;
public class DeltaFusion extends Sprite {
public var volumeBMG:Number;// = 0.5
private var BGMusicChannel:SoundChannel;
public var white:int;// = 0xFFFFFF
private var currentMusic:Sound;
public var orange:int;// = 0xFF8800
public var blue:int;// = 0xFF
public var lastSegs:int;// = 4
public var yellow:int;// = 0xFFFF00
public var red:int;// = 0xFF0000
public var score:uint;// = 0
public var magenta:int;// = 0xFF00FF
public var playername:String;// = "noname"
public var bluegreen:int;// = 35071
public var tumbleCombo:int;// = 0
public var green:int;// = 0xFF00
public var volumeSFX:Number;// = 0.5
var gameOver1:TitleGameOver;
public var blue1:int;// = 13226
public var blue3:int;// = 43775
public var blue4:int;// = 11154431
public var blue5:int;// = 3368703
public var yellowgreen:int;// = 0x88FF00
var submitTitle:TitleSubmitScore;
public var cyan:int;// = 0xFFFF
var viewScores:TitleViewHighScores;
private var paused:Boolean;// = false
public var blue2:int;// = 0x3300AA
public var bluemagenta:int;// = 0x8800FF
public var levelNum:int;// = 1
public var triArray:Array;
public var level:GameLevel;
public var gameTitle:GameTitle;
var titleYouWin:TitleYouWin;
public var purple:int;// = 0xFF0088
public var orientation:String;// = "12"
public var maxLevels:int;// = 50
public var black:int;// = 0
public function DeltaFusion(){
levelNum = 1;
maxLevels = 50;
playername = "noname";
volumeBMG = 0.5;
volumeSFX = 0.5;
triArray = new Array(0);
score = 0;
tumbleCombo = 0;
lastSegs = 4;
orientation = "12";
green = 0xFF00;
yellowgreen = 0x88FF00;
yellow = 0xFFFF00;
orange = 0xFF8800;
red = 0xFF0000;
purple = 0xFF0088;
magenta = 0xFF00FF;
bluemagenta = 0x8800FF;
blue = 0xFF;
bluegreen = 35071;
blue1 = 13226;
blue2 = 0x3300AA;
blue3 = 43775;
blue4 = 11154431;
blue5 = 3368703;
cyan = 0xFFFF;
white = 0xFFFFFF;
black = 0;
BGMusicChannel = new SoundChannel();
paused = false;
super();
Security.allowDomain("*");
Security.allowDomain("arthavoc.com", "newgrounds.com", "kongregate.com");
Security.allowInsecureDomain("*");
Security.allowInsecureDomain("arthavoc.com", "newgrounds.com", "kongregate.com");
}
public function loadNextLevel(_arg1:Array, _arg2:int, _arg3:String, _arg4:int){
removeChild(level);
triArray = _arg1;
score = _arg2;
orientation = _arg3;
tumbleCombo = _arg4;
levelNum = (levelNum + 1);
if (levelNum <= maxLevels){
loadLevel();
} else {
youWin();
tumbleCombo = 0;
};
}
public function loadLevel(){
var _local1:int;
var _local2:int;
var _local3:String;
var _local4:int;
var _local5:Array;
var _local6:int;
var _local7:int;
_local3 = new String("pretty colors");
_local6 = 500;
_local7 = 25;
_local2 = (_local6 - ((_local6 - _local7) * (levelNum / maxLevels)));
if ((((levelNum >= 0)) && ((levelNum <= 9)))){
_local5 = new Array(red, orange);
_local1 = 5;
} else {
if ((((levelNum >= 10)) && ((levelNum <= 19)))){
_local5 = new Array(red, orange);
_local1 = 5;
} else {
if ((((levelNum >= 20)) && ((levelNum <= 29)))){
_local5 = new Array(red, orange, yellow);
_local1 = 6;
} else {
if ((((levelNum >= 30)) && ((levelNum <= 39)))){
_local5 = new Array(red, orange, yellow);
_local1 = 6;
} else {
if ((((levelNum >= 40)) && ((levelNum <= 49)))){
_local5 = new Array(red, orange, yellow, green);
_local1 = 7;
} else {
if (levelNum == 50){
_local5 = new Array(red, orange, yellow, green);
_local1 = 7;
};
};
};
};
};
};
_local3 = new String("pretty colors");
_local4 = 12;
trace(("colors" + _local5));
trace(("timeCycle" + _local2));
if (_local1 != lastSegs){
if (triArray.length > 0){
slideTris(lastSegs, _local1);
};
};
level = new GameLevel(this, _local1, _local2, _local5, _local3, _local4, triArray, score, orientation, tumbleCombo, volumeSFX);
level.x = 225;
level.y = 225;
lastSegs = _local1;
addChild(level);
stage.focus = level;
}
public function returnToMenuPause(){
if (level.parent == this){
level.cleanUp();
removeChild(level);
};
stopMusic();
gameTitle = new GameTitle(this);
addChild(gameTitle);
gameTitle.x = 225;
gameTitle.y = 225;
}
public function goToSubmitGameOver(){
if (gameOver1.parent == this){
removeChild(gameOver1);
};
submitTitle = new TitleSubmitScore(this, score, playername);
addChild(submitTitle);
}
public function returnToMenuViewScores(){
if (viewScores.parent == this){
removeChild(viewScores);
};
stopMusic();
gameTitle = new GameTitle(this);
addChild(gameTitle);
gameTitle.x = 225;
gameTitle.y = 225;
}
public function goToSubmitYouWin(_arg1:int){
score = _arg1;
if (titleYouWin.parent == this){
removeChild(titleYouWin);
};
submitTitle = new TitleSubmitScore(this, score, playername);
addChild(submitTitle);
}
public function getLevelNumber():int{
return (levelNum);
}
public function setMusic(_arg1:String){
stopMusic();
switch (_arg1){
case "bmg1":
currentMusic = Sound(new deltaloopmusic());
break;
case "end1":
currentMusic = Sound(new grinderloop());
break;
case "win1":
currentMusic = Sound(new deltaendloop());
break;
};
playMusic();
}
private function splitURLToArray(_arg1:String):Array{
var _local2:*;
var _local3:*;
var _local4:int;
var _local5:Array;
var _local6:Array;
_local2 = new Array();
_local3 = new Array();
_local3 = _arg1.split("&");
_local4 = 0;
while (_local4 < ((_local3.length / 2) - 1)) {
_local5 = _local3[(_local4 * 2)].split("=");
_local6 = _local3[((_local4 * 2) + 1)].split("=");
_local2.push(new Array(_local5, _local6));
_local4++;
};
return (_local2);
}
public function unpause(){
if (paused){
playMusic();
paused = false;
level.unpause();
};
}
public function getBMGVolume():Number{
return (volumeBMG);
}
public function loadGameOver(_arg1:Number){
score = _arg1;
if (level.parent == this){
removeChild(level);
};
setMusic("end1");
gameOver1 = new TitleGameOver(this, _arg1);
addChild(gameOver1);
}
public function init(_arg1:Boolean){
stage.scaleMode = StageScaleMode.NO_SCALE;
gameTitle = new GameTitle(this);
addChild(gameTitle);
gameTitle.x = 225;
gameTitle.y = 225;
}
public function viewHighScoresSubmit(_arg1:String){
var _local2:Array;
if (submitTitle.parent == this){
removeChild(submitTitle);
};
_local2 = splitURLToArray(_arg1);
viewScores = new TitleViewHighScores(this, _local2);
addChild(viewScores);
gameTitle.x = 225;
gameTitle.y = 225;
}
public function getMaxLevels():int{
return (maxLevels);
}
public function stopMusic(){
BGMusicChannel.stop();
}
public function youWin(){
if (level.parent == this){
removeChild(level);
};
setMusic("win1");
titleYouWin = new TitleYouWin(this, score);
addChild(titleYouWin);
}
public function getSFXVolume():Number{
return (volumeSFX);
}
public function playMusic(){
BGMusicChannel = currentMusic.play(0, int.MAX_VALUE);
BGMusicChannel.soundTransform = new SoundTransform(volumeBMG, 0);
}
public function reloadLevel(){
removeChild(level);
loadLevel();
}
public function sendHighScore(_arg1:String, _arg2:int){
var _local3:Loader;
var _local4:URLRequest;
playername = _arg1;
_local3 = new Loader();
_local4 = new URLRequest("http://www.arthavoc.com/DeltaFusionScoreboard.swf");
_local3.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompleteHandler);
_local3.load(_local4);
}
public function setBMGVolume(_arg1:Number){
volumeBMG = _arg1;
BGMusicChannel.soundTransform = new SoundTransform(volumeBMG, 0);
}
public function slideTris(_arg1:int, _arg2:int){
var _local3:int;
var _local4:int;
var _local5:GameTriangle;
if (_arg2 > _arg1){
_local3 = (_arg2 - _arg1);
_local4 = 0;
while (_local4 < triArray.length) {
_local5 = GameTriangle(triArray[_local4]);
GameTriangle(triArray[_local4]).setRow((_local5.getRow() + (2 * _local3)));
_local5.setCol((_local5.getCol() + _local3));
_local4++;
};
};
}
public function startGame(){
score = 0;
orientation = "12";
tumbleCombo = 0;
lastSegs = 4;
setMusic("bmg1");
removeChild(gameTitle);
levelNum = 1;
triArray = new Array();
loadLevel();
}
private function handleComplete(_arg1:Event):void{
trace("this far... really?");
trace(_arg1.target);
trace(_arg1.target.data);
trace(_arg1);
trace(_arg1.type);
viewHighScoresSubmit(_arg1.target.data);
}
public function returnToMenuYouWin(){
if (titleYouWin.parent == this){
removeChild(titleYouWin);
};
stopMusic();
gameTitle = new GameTitle(this);
addChild(gameTitle);
gameTitle.x = 225;
gameTitle.y = 225;
}
public function setSFXVolume(_arg1:Number){
volumeSFX = _arg1;
level.setSFXVolume(_arg1);
}
private function onIOError(_arg1:IOErrorEvent):void{
}
public function returnToTitleSubmit(){
if (submitTitle.parent == this){
removeChild(submitTitle);
};
stopMusic();
gameTitle = new GameTitle(this);
addChild(gameTitle);
gameTitle.x = 225;
gameTitle.y = 225;
}
public function returnToMenuGameOver(){
if (gameOver1.parent == this){
removeChild(gameOver1);
};
stopMusic();
gameTitle = new GameTitle(this);
addChild(gameTitle);
gameTitle.x = 225;
gameTitle.y = 225;
}
private function onCompleteHandler(_arg1:Event){
_arg1.currentTarget.content.addEventListener("COMPLETE", handleComplete);
_arg1.currentTarget.content.sendHighScore(playername, score);
}
public function pause(){
if (!paused){
stopMusic();
paused = true;
level.pause();
};
}
}
}//package
Section 43
//deltaloopmusic (deltaloopmusic)
package {
import flash.media.*;
public dynamic class deltaloopmusic extends Sound {
}
}//package
Section 44
//destroypiecesound (destroypiecesound)
package {
import flash.media.*;
public dynamic class destroypiecesound extends Sound {
}
}//package
Section 45
//FadeToWhite (FadeToWhite)
package {
import flash.display.*;
public dynamic class FadeToWhite extends MovieClip {
public function FadeToWhite(){
addFrameScript(47, frame48);
}
function frame48(){
stop();
}
}
}//package
Section 46
//Fire (Fire)
package {
import flash.display.*;
public dynamic class Fire extends MovieClip {
public function Fire(){
addFrameScript(29, frame30);
}
function frame30(){
stop();
}
}
}//package
Section 47
//futuristicbuzzsound (futuristicbuzzsound)
package {
import flash.media.*;
public dynamic class futuristicbuzzsound extends Sound {
}
}//package
Section 48
//GameOver1 (GameOver1)
package {
import flash.display.*;
import flash.text.*;
public dynamic class GameOver1 extends MovieClip {
public var _finalScore:TextField;
public var _resetButton:ResetButton;
public var _buttonSubmit:buttonSubmit;
public function GameOver1(){
addFrameScript(64, frame65);
}
function frame65(){
stop();
}
}
}//package
Section 49
//Glow (Glow)
package {
import flash.display.*;
public dynamic class Glow extends MovieClip {
}
}//package
Section 50
//GlowRays (GlowRays)
package {
import flash.display.*;
public dynamic class GlowRays extends MovieClip {
}
}//package
Section 51
//grinderloop (grinderloop)
package {
import flash.media.*;
public dynamic class grinderloop extends Sound {
}
}//package
Section 52
//HexScoringEvent (HexScoringEvent)
package {
import flash.display.*;
public dynamic class HexScoringEvent extends MovieClip {
public function HexScoringEvent(){
addFrameScript(24, frame25);
}
function frame25(){
stop();
}
}
}//package
Section 53
//LevelBackground (LevelBackground)
package {
import flash.display.*;
import flash.text.*;
public dynamic class LevelBackground extends MovieClip {
public var _tumbleTimer:TextField;
public var _pauseButton:levelPauseButton;
public var _tris:TextField;
public var _blueBar:BlueBar;
public var _shapes:TextField;
public var _levelNumber:TextField;
public var _comboPoints:TextField;
public var _tumbleCombo:TextField;
public var _scoreText:TextField;
public var _redBar:RedBar;
}
}//package
Section 54
//levelPauseButton (levelPauseButton)
package {
import flash.display.*;
public dynamic class levelPauseButton extends SimpleButton {
}
}//package
Section 55
//maskRectangle (maskRectangle)
package {
import flash.display.*;
public dynamic class maskRectangle extends MovieClip {
}
}//package
Section 56
//MochiAd (MochiAd)
package {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.system.*;
import flash.net.*;
public class MochiAd {
public static function getVersion():String{
return ("2.1");
}
public static function showTimedAd(_arg1:Object):void{
MochiAd.showInterLevelAd(_arg1);
}
public static function _allowDomains(_arg1:String):String{
var _local2:String;
_local2 = _arg1.split("/")[2].split(":")[0];
Security.allowDomain("*");
Security.allowDomain(_local2);
Security.allowInsecureDomain("*");
Security.allowInsecureDomain(_local2);
return (_local2);
}
public static function load(_arg1:Object):MovieClip{
var DEFAULTS:Object;
var clip:Object;
var depth:Number;
var mc:MovieClip;
var wh:Array;
var lv:URLVariables;
var k:String;
var server:String;
var hostname:String;
var lc:LocalConnection;
var name:String;
var loader:Loader;
var f:Function;
var g:Function;
var req:URLRequest;
var v:Object;
var options = _arg1;
DEFAULTS = {server:"http://x.mochiads.com/srv/1/", method:"load", depth:10333, id:"_UNKNOWN_"};
options = MochiAd._parseOptions(options, DEFAULTS);
options.swfv = 9;
options.mav = MochiAd.getVersion();
clip = options.clip;
if (!MochiAd._isNetworkAvailable()){
return (null);
};
if (clip._mochiad_loaded){
return (null);
};
depth = options.depth;
delete options.depth;
mc = createEmptyMovieClip(clip, "_mochiad", depth);
wh = MochiAd._getRes(options, clip);
options.res = ((wh[0] + "x") + wh[1]);
options.server = (options.server + options.id);
delete options.id;
clip._mochiad_loaded = true;
if (clip.loaderInfo.loaderURL.indexOf("http") == 0){
options.as3_swf = clip.loaderInfo.loaderURL;
};
lv = new URLVariables();
for (k in options) {
v = options[k];
if (!(v is Function)){
lv[k] = v;
};
};
server = lv.server;
delete lv.server;
hostname = _allowDomains(server);
lc = new LocalConnection();
lc.client = mc;
name = ["", Math.floor(new Date().getTime()), Math.floor((Math.random() * 999999))].join("_");
lc.allowDomain("*", "localhost");
lc.allowInsecureDomain("*", "localhost");
lc.connect(name);
mc.lc = lc;
lv.lc = name;
lv.st = getTimer();
loader = new Loader();
f = function (_arg1:Object):void{
mc._mochiad_ctr_failed = true;
};
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, f);
g = function (_arg1:Object):void{
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 sendHighScore(_arg1:Object, _arg2:Object, _arg3:Object=null):Boolean{
var _local4:MovieClip;
_local4 = MochiAd._loadCommunicator({clip:_arg1.clip, id:_arg1.id});
if (!_local4){
return (false);
};
_local4.doSend(["sendHighScore", _arg1], _arg2, _arg3);
return (true);
}
public static function _parseOptions(_arg1:Object, _arg2:Object):Object{
var _local3:Object;
var _local4:String;
var _local5:Array;
var _local6:Number;
var _local7:Array;
_local3 = {};
for (_local4 in _arg2) {
_local3[_local4] = _arg2[_local4];
};
if (_arg1){
for (_local4 in _arg1) {
_local3[_local4] = _arg1[_local4];
};
};
_arg1 = _local3.clip.loaderInfo.parameters.mochiad_options;
if (_arg1){
_local5 = _arg1.split("&");
_local6 = 0;
while (_local6 < _local5.length) {
_local7 = _local5[_local6].split("=");
_local3[unescape(_local7[0])] = unescape(_local7[1]);
_local6++;
};
};
return (_local3);
}
public static function _isNetworkAvailable():Boolean{
return (!((Security.sandboxType == "localWithFile")));
}
public static function unload(_arg1:Object):Boolean{
if (((_arg1.clip) && (_arg1.clip._mochiad))){
_arg1 = _arg1.clip;
};
if (!_arg1._mochiad){
return (false);
};
if (_arg1._mochiad.onUnload){
_arg1._mochiad.onUnload();
};
_arg1.removeChild(_arg1._mochiad);
delete _arg1._mochiad_loaded;
delete _arg1._mochiad;
return (true);
}
public static function showInterLevelAd(_arg1:Object):void{
var DEFAULTS:Object;
var clip:Object;
var ad_msec:Number;
var ad_timeout:Number;
var fadeout_time:Number;
var mc:MovieClip;
var wh:Array;
var w:Number;
var h:Number;
var chk:MovieClip;
var options = _arg1;
DEFAULTS = {ad_timeout:2000, fadeout_time:250, regpt:"o", method:"showTimedAd", ad_started:function ():void{
this.clip.stop();
}, ad_finished:function ():void{
this.clip.play();
}};
options = MochiAd._parseOptions(options, DEFAULTS);
clip = options.clip;
ad_msec = 11000;
ad_timeout = options.ad_timeout;
delete options.ad_timeout;
fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!MochiAd.load(options)){
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
options.ad_finished();
};
wh = MochiAd._getRes(options, clip);
w = wh[0];
h = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.ad_msec = ad_msec;
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function ():void{
var _local1:Number;
_local1 = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time)));
if (_local1 > 0){
this.parent.alpha = (_local1 * 0.01);
} else {
MochiAd.unload(clip);
delete this["onEnterFrame"];
};
};
mc.unloadAd = function ():void{
MochiAd.unload(clip);
};
mc.adjustProgress = function (_arg1:Number):void{
var _local2:Object;
_local2 = mc._mochiad_wait;
_local2.server_control = true;
_local2.started = getTimer();
_local2.ad_msec = (_arg1 - 250);
};
chk["onEnterFrame"] = function ():void{
var _local1:Object;
var _local2:Number;
var _local3:Boolean;
var _local4:Number;
_local1 = this.parent._mochiad_ctr;
_local2 = (getTimer() - this.started);
_local3 = false;
if (!chk.showing){
_local4 = _local1.loaderInfo.bytesTotal;
if ((((_local4 > 0)) || (("number" == "undefined")))){
chk.showing = true;
chk.started = getTimer();
} else {
if (_local2 > chk.ad_timeout){
_local3 = true;
};
};
};
if ((((_local2 > chk.ad_msec)) || (this.parent._mochiad_ctr_failed))){
_local3 = true;
};
if (_local3){
if (this.server_control){
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = this.fadeFunction;
};
};
};
doOnEnterFrame(chk);
}
public static function _getRes(_arg1:Object, _arg2:Object):Array{
var _local3:Object;
var _local4:Number;
var _local5:Number;
var _local6:Array;
_local3 = _arg2.getBounds(_arg2.root);
_local4 = 0;
_local5 = 0;
if (typeof(_arg1.res) != "undefined"){
_local6 = _arg1.res.split("x");
_local4 = parseFloat(_local6[0]);
_local5 = parseFloat(_local6[1]);
} else {
_local4 = (_local3.xMax - _local3.xMin);
_local5 = (_local3.yMax - _local3.yMin);
};
if ((((_local4 == 0)) || ((_local5 == 0)))){
_local4 = _arg2.stage.stageWidth;
_local5 = _arg2.stage.stageHeight;
};
return ([_local4, _local5]);
}
public static function createEmptyMovieClip(_arg1:Object, _arg2:String, _arg3:Number):MovieClip{
var _local4:MovieClip;
_local4 = new MovieClip();
if (((false) && (_arg3))){
_arg1.addChildAt(_local4, _arg3);
} else {
_arg1.addChild(_local4);
};
_arg1[_arg2] = _local4;
_local4["_name"] = _arg2;
return (_local4);
}
public static function _loadCommunicator(_arg1:Object):MovieClip{
var DEFAULTS:Object;
var clip:Object;
var clipname:String;
var server:String;
var depth:Number;
var mc:MovieClip;
var lv:URLVariables;
var k:String;
var lc:LocalConnection;
var name:String;
var req:URLRequest;
var loader:Loader;
var options = _arg1;
DEFAULTS = {com_server:"http://x.mochiads.com/com/1/", method:"loadCommunicator", depth:10337, id:"_UNKNOWN_"};
options = MochiAd._parseOptions(options, DEFAULTS);
options.swfv = 9;
options.mav = MochiAd.getVersion();
clip = options.clip;
clipname = ("_mochiad_com_" + options.id);
if (!MochiAd._isNetworkAvailable()){
return (null);
};
if (clip[clipname]){
return (clip[clipname]);
};
server = (options.com_server + options.id);
MochiAd._allowDomains(server);
delete options.id;
delete options.com_server;
depth = options.depth;
delete options.depth;
mc = createEmptyMovieClip(clip, clipname, depth);
lv = new URLVariables();
for (k in options) {
lv[k] = options[k];
};
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.name = name;
mc.lc = lc;
lv.lc = name;
mc._id = 0;
mc._queue = [];
mc.rpcResult = function (_arg1:Object):void{
var _local3:Array;
var _local4:Array;
var _local5:Number;
var _local6:Object;
var _local7:Object;
_arg1 = parseInt(_arg1.toString());
_local3 = mc._callbacks[_arg1];
if (typeof(_local3) == "undefined"){
return;
};
delete mc._callbacks[_arg1];
_local4 = [];
_local5 = 2;
while (_local5 < _local3.length) {
_local4.push(_local3[_local5]);
_local5++;
};
_local5 = 1;
while (_local5 < arguments.length) {
_local4.push(arguments[_local5]);
_local5++;
};
_local6 = _local3[1];
_local7 = _local3[0];
if (((_local7) && ((typeof(_local6) == "string")))){
_local6 = _local7[_local6];
};
if (typeof(_local6) == "function"){
_local6.apply(_local7, _local4);
};
};
mc._didConnect = function (_arg1:String):void{
var _local2:Array;
var _local3:Function;
var _local4:Number;
var _local5:Array;
mc._endpoint = _arg1;
_local2 = mc._queue;
delete mc._queue;
_local3 = mc.doSend;
_local4 = 0;
while (_local4 < _local2.length) {
_local5 = _local2[_local4];
_local3.apply(this, _local5);
_local4++;
};
};
mc.doSend = function (_arg1:Array, _arg2:Object, _arg3:Object):void{
var _local5:Number;
var _local6:LocalConnection;
var _local7:Array;
var _local8:Number;
if (mc._endpoint == null){
_local7 = [];
_local8 = 0;
while (_local8 < arguments.length) {
_local7.push(arguments[_local8]);
_local8++;
};
mc._queue.push(_local7);
return;
};
mc._id = (mc._id + 1);
_local5 = mc._id;
mc._callbacks[_local5] = [_arg2, ((_arg3) || (_arg2))];
_local6 = new LocalConnection();
_local6.send(mc._endpoint, "rpc", _local5, _arg1);
};
mc._callbacks = {};
mc._callbacks[0] = [mc, "_didConnect"];
lv.st = getTimer();
req = new URLRequest((server + ".swf"));
req.contentType = "application/x-www-form-urlencoded";
req.method = URLRequestMethod.POST;
req.data = lv;
loader = new Loader();
loader.load(req);
mc.addChild(loader);
mc._mochiad_com = loader;
return (mc);
}
public static function showPreGameAd(_arg1:Object):void{
var DEFAULTS:Object;
var clip:Object;
var ad_msec:Number;
var ad_timeout:Number;
var fadeout_time:Number;
var mc:MovieClip;
var wh:Array;
var w:Number;
var h:Number;
var chk:MovieClip;
var bar:MovieClip;
var bar_color:Number;
var bar_background:Number;
var bar_outline:Number;
var backing_mc:MovieClip;
var backing:Object;
var inside_mc:MovieClip;
var inside:Object;
var outline_mc:MovieClip;
var outline:Object;
var complete:Boolean;
var unloaded:Boolean;
var f:Function;
var r:MovieClip;
var options = _arg1;
DEFAULTS = {ad_timeout:3000, fadeout_time:250, regpt:"o", method:"showPreloaderAd", color:0xFF8A00, background:16777161, outline:13994812, ad_started:function ():void{
this.clip.stop();
}, ad_finished:function ():void{
this.clip.play();
}};
options = MochiAd._parseOptions(options, DEFAULTS);
clip = options.clip;
ad_msec = 11000;
ad_timeout = options.ad_timeout;
delete options.ad_timeout;
fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!MochiAd.load(options)){
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
var fn:Function;
fn = function ():void{
options.ad_finished();
};
setTimeout(fn, 100);
};
wh = MochiAd._getRes(options, clip);
w = wh[0];
h = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.x = (w * -0.5);
chk.y = (h * -0.5);
bar = createEmptyMovieClip(chk, "_mochiad_bar", 4);
bar.x = 10;
bar.y = (h - 20);
bar_color = options.color;
delete options.color;
bar_background = options.background;
delete options.background;
bar_outline = options.outline;
delete options.outline;
backing_mc = createEmptyMovieClip(bar, "_outline", 1);
backing = backing_mc.graphics;
backing.beginFill(bar_background);
backing.moveTo(0, 0);
backing.lineTo((w - 20), 0);
backing.lineTo((w - 20), 10);
backing.lineTo(0, 10);
backing.lineTo(0, 0);
backing.endFill();
inside_mc = createEmptyMovieClip(bar, "_inside", 2);
inside = inside_mc.graphics;
inside.beginFill(bar_color);
inside.moveTo(0, 0);
inside.lineTo((w - 20), 0);
inside.lineTo((w - 20), 10);
inside.lineTo(0, 10);
inside.lineTo(0, 0);
inside.endFill();
inside_mc.scaleX = 0;
outline_mc = createEmptyMovieClip(bar, "_outline", 3);
outline = outline_mc.graphics;
outline.lineStyle(0, bar_outline, 100);
outline.moveTo(0, 0);
outline.lineTo((w - 20), 0);
outline.lineTo((w - 20), 10);
outline.lineTo(0, 10);
outline.lineTo(0, 0);
chk.ad_msec = ad_msec;
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
chk.last_pcnt = 0;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function ():void{
var _local1:Number;
_local1 = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time)));
if (_local1 > 0){
this.parent.alpha = (_local1 * 0.01);
} else {
MochiAd.unload(clip);
delete this["onEnterFrame"];
};
};
complete = false;
unloaded = false;
f = function (_arg1:Event):void{
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.adjustProgress = function (_arg1:Number):void{
var _local2:Object;
_local2 = mc._mochiad_wait;
_local2.server_control = true;
_local2.started = getTimer();
_local2.ad_msec = _arg1;
};
chk["onEnterFrame"] = function ():void{
var _local1:Object;
var _local2:Object;
var _local3:Number;
var _local4:Boolean;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Object;
var _local10:Number;
var _local11:Number;
if (!this.parent.parent){
delete this["onEnterFrame"];
return;
};
_local1 = this.parent.parent.root;
_local2 = this.parent._mochiad_ctr;
_local3 = (getTimer() - this.started);
_local4 = false;
_local5 = _local1.loaderInfo.bytesTotal;
_local6 = _local1.loaderInfo.bytesLoaded;
_local7 = ((100 * _local6) / _local5);
_local8 = ((100 * _local3) / chk.ad_msec);
_local9 = this._mochiad_bar._inside;
_local10 = Math.min(100, Math.min(((_local7) || (0)), _local8));
_local10 = Math.max(this.last_pcnt, _local10);
this.last_pcnt = _local10;
_local9.scaleX = (_local10 * 0.01);
if (!chk.showing){
_local11 = _local2.loaderInfo.bytesTotal;
if ((((_local11 > 0)) || (("number" == "undefined")))){
chk.showing = true;
chk.started = getTimer();
} else {
if (_local3 > chk.ad_timeout){
_local4 = true;
};
};
};
if ((((_local3 > chk.ad_msec)) || (this.parent._mochiad_ctr_failed))){
_local4 = true;
};
if (((complete) && (_local4))){
if (this.server_control){
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = chk.fadeFunction;
};
};
};
doOnEnterFrame(chk);
}
public static function showPreloaderAd(_arg1:Object):void{
MochiAd.showPreGameAd(_arg1);
}
public static function fetchHighScores(_arg1:Object, _arg2:Object, _arg3:Object=null):Boolean{
var _local4:MovieClip;
_local4 = MochiAd._loadCommunicator({clip:_arg1.clip, id:_arg1.id});
if (!_local4){
return (false);
};
_local4.doSend(["fetchHighScores", _arg1], _arg2, _arg3);
return (true);
}
public static function doOnEnterFrame(_arg1:MovieClip):void{
var f:Function;
var mc = _arg1;
f = function (_arg1:Object):void{
if (((("onEnterFrame" in mc)) && (mc.onEnterFrame))){
mc.onEnterFrame();
} else {
mc.removeEventListener(Event.ENTER_FRAME, f);
};
};
mc.addEventListener(Event.ENTER_FRAME, f);
}
}
}//package
Section 57
//NewLevelParticle (NewLevelParticle)
package {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.media.*;
import flash.text.*;
import flash.utils.*;
import flash.system.*;
import flash.net.*;
import flash.ui.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.xml.*;
public dynamic class NewLevelParticle extends MovieClip {
public var _lpgraphics:MovieClip;
public function NewLevelParticle(){
addFrameScript(0, frame1);
}
function frame1(){
this.setLevel(4);
}
public function setLevel(_arg1:int){
_lpgraphics.setLevelNum(_arg1);
}
}
}//package
Section 58
//pJet (pJet)
package {
import flash.display.*;
public dynamic class pJet extends MovieClip {
}
}//package
Section 59
//Preloader (Preloader)
package {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
public dynamic class Preloader extends MovieClip {
private var did_load:Boolean;
public static var GAME_OPTIONS:Object = {id:"c6af5b8b093e39d9", res:"450x450"};
public static var MAIN_CLASS:String = "DeltaFusion";
public function Preloader(){
var f:Function;
var opts:Object;
var k:String;
super();
f = function (_arg1:IOErrorEvent):void{
};
loaderInfo.addEventListener(IOErrorEvent.IO_ERROR, f);
stage.scaleMode = StageScaleMode.NO_SCALE;
opts = {};
for (k in GAME_OPTIONS) {
opts[k] = GAME_OPTIONS[k];
};
opts.ad_started = function ():void{
did_load = true;
};
opts.ad_finished = function ():void{
var _local1:Class;
var _local2:Object;
_local1 = Class(getDefinitionByName(MAIN_CLASS));
_local2 = new (_local1);
parent.addChild((_local2 as DisplayObject));
if (_local2.init){
_local2.init(did_load);
};
};
opts.clip = this;
MochiAd.showPreGameAd(opts);
}
}
}//package
Section 60
//ReactionIndicator (ReactionIndicator)
package {
import flash.display.*;
public dynamic class ReactionIndicator extends MovieClip {
public var _mask:ReactorMask;
}
}//package
Section 61
//ReactorMask (ReactorMask)
package {
import flash.display.*;
public dynamic class ReactorMask extends MovieClip {
}
}//package
Section 62
//RedBar (RedBar)
package {
import flash.display.*;
public dynamic class RedBar extends MovieClip {
public var _maskLayer:CropPlane;
public function RedBar(){
addFrameScript(0, frame1);
}
public function setCrop(_arg1:Number){
if (_arg1 == 0){
_maskLayer.y = 0;
} else {
if (_arg1 == 100){
_maskLayer.y = 320.9;
} else {
_maskLayer.y = ((261 * _arg1) + 17);
};
};
}
function frame1(){
}
}
}//package
Section 63
//ResetButton (ResetButton)
package {
import flash.display.*;
public dynamic class ResetButton extends SimpleButton {
}
}//package
Section 64
//ScoreBox (ScoreBox)
package {
import flash.display.*;
import flash.text.*;
public dynamic class ScoreBox extends MovieClip {
public var _place:TextField;
public var _name:TextField;
public var _score:TextField;
public function ScoreBox(){
addFrameScript(0, frame1);
}
public function setParameters(_arg1:int, _arg2:String, _arg3:Number):void{
_place.text = new String(_arg1);
_name.text = _arg2;
_score.text = new String(_arg3);
}
function frame1(){
}
}
}//package
Section 65
//ScoringParticle (ScoringParticle)
package {
import flash.display.*;
public dynamic class ScoringParticle extends MovieClip {
public function ScoringParticle(){
addFrameScript(9, frame10);
}
function frame10(){
stop();
}
}
}//package
Section 66
//sliderDial (sliderDial)
package {
import flash.display.*;
public dynamic class sliderDial extends SimpleButton {
}
}//package
Section 67
//Steam (Steam)
package {
import flash.display.*;
public dynamic class Steam extends MovieClip {
public function Steam(){
addFrameScript(23, frame24);
}
function frame24(){
stop();
}
}
}//package
Section 68
//thudsound (thudsound)
package {
import flash.media.*;
public dynamic class thudsound extends Sound {
}
}//package
Section 69
//Title (Title)
package {
import flash.display.*;
public dynamic class Title extends MovieClip {
public var _startButton:SimpleButton;
}
}//package
Section 70
//TitlePauseGraphic (TitlePauseGraphic)
package {
import flash.display.*;
public dynamic class TitlePauseGraphic extends MovieClip {
public var _bmgSlider:VolumeSlider;
public var _sfxSlider:VolumeSlider;
public var _unpauseButton:buttonUnpause;
public var _resetButton:ResetButton;
}
}//package
Section 71
//TitleSubmitScoreGraphics (TitleSubmitScoreGraphics)
package {
import flash.display.*;
import flash.text.*;
public dynamic class TitleSubmitScoreGraphics extends MovieClip {
public var _userText:TextField;
public var _scoreText:TextField;
public var _resetButton:ResetButton;
public var _buttonSubmit:buttonSubmit;
}
}//package
Section 72
//TitleViewScoreGraphics (TitleViewScoreGraphics)
package {
import flash.display.*;
public dynamic class TitleViewScoreGraphics extends MovieClip {
public var _sb2:ScoreBox;
public var _sb3:ScoreBox;
public var _sb9:ScoreBox;
public var _sb4:ScoreBox;
public var _sb5:ScoreBox;
public var _sb1:ScoreBox;
public var _sb6:ScoreBox;
public var _sb7:ScoreBox;
public var _sb8:ScoreBox;
public var _sb10:ScoreBox;
public var _sb:ResetButton;
}
}//package
Section 73
//titleYouWinGraphics (titleYouWinGraphics)
package {
import flash.display.*;
import flash.text.*;
public dynamic class titleYouWinGraphics extends MovieClip {
public var _finalScore:TextField;
public var _resetButton:ResetButton;
public var _buttonSubmit:buttonSubmit;
public function titleYouWinGraphics(){
addFrameScript(38, frame39);
}
function frame39(){
stop();
}
}
}//package
Section 74
//TriScoringEvent (TriScoringEvent)
package {
import flash.display.*;
public dynamic class TriScoringEvent extends MovieClip {
public function TriScoringEvent(){
addFrameScript(24, frame25);
}
function frame25(){
stop();
}
}
}//package
Section 75
//wheelturnsound (wheelturnsound)
package {
import flash.media.*;
public dynamic class wheelturnsound extends Sound {
}
}//package
Section 76
//winlevelsound (winlevelsound)
package {
import flash.media.*;
public dynamic class winlevelsound extends Sound {
}
}//package
Section 77
//VolumeSlider (VolumeSlider)
package {
import flash.events.*;
import flash.display.*;
public dynamic class VolumeSlider extends MovieClip {
public var sWidth:Number;
public var _dragDial:sliderDial;
public var maxX:int;
public var fract:Number;
public var minX:int;
public var _highlightMask:maskRectangle;
public var highlightMask:MovieClip;
public var dragDial:SimpleButton;
public var widthThing:MovieClip;
public var widthIndicator:maskRectangle;
public function VolumeSlider(){
addFrameScript(0, frame1);
}
public function setFract(){
var _local1:Number;
_local1 = (minX + (fract * sWidth));
dragDial.x = _local1;
highlightMask.x = _local1;
}
public function init(){
widthThing = widthIndicator;
sWidth = widthThing.width;
minX = widthThing.x;
maxX = (widthThing.x + sWidth);
dragDial = _dragDial;
highlightMask = _highlightMask;
dragDial.addEventListener(MouseEvent.MOUSE_DOWN, startDragDial);
setFract();
}
public function sliderSlide(_arg1:Event){
var _local2:Number;
var _local3:Event;
_local2 = mouseX;
if (_local2 > maxX){
_local2 = maxX;
};
if (_local2 < minX){
_local2 = minX;
};
fract = ((_local2 - minX) / sWidth);
setFract();
_local3 = new Event("DIAL");
dispatchEvent(_local3);
}
function frame1(){
sWidth = 400;
init();
}
public function getFract():Number{
return (fract);
}
public function startDragDial(_arg1:Event){
var _local2:Event;
_local2 = new Event("DIALSTART");
dispatchEvent(_local2);
addEventListener(Event.ENTER_FRAME, sliderSlide);
dragDial.removeEventListener(MouseEvent.MOUSE_DOWN, startDragDial);
dragDial.addEventListener(MouseEvent.MOUSE_UP, endDragDial);
parent.addEventListener(MouseEvent.MOUSE_UP, endDragDial);
}
public function endDragDial(_arg1:Event){
var _local2:Event;
_local2 = new Event("DIALEND");
dispatchEvent(_local2);
removeEventListener(Event.ENTER_FRAME, sliderSlide);
dragDial.addEventListener(MouseEvent.MOUSE_DOWN, startDragDial);
parent.removeEventListener(MouseEvent.MOUSE_UP, endDragDial);
dragDial.removeEventListener(MouseEvent.MOUSE_UP, endDragDial);
}
}
}//package