Section 1
//Board (Board)
package {
import flash.events.*;
import flash.media.*;
import flash.display.*;
import flash.text.*;
import flash.utils.*;
public dynamic class Board extends MovieClip {
public var boardLayer:MovieClip;
public var bgLayer:MovieClip;
public var backSet:MovieClip;
public var bg:MovieClip;
public var xpcountdown:XPCountdown;
public var totalactivations:Number;// = 0
public var timeleft:int;// = 180
public var STARTINGLEFT;// = 185
public var xptonextlevel:int;// = 5
public var tilearray:Array;
public var feedd:Array;
public var piecelist:Array;
public var powerserver:PowerServer;
public var feedu:Array;
public var feedl:Array;
public var feedr:Array;
public var chuteLayer:MovieClip;
public var finalScore:ScoreField;
public var STARTINGTOP;
public var pieceLayer:MovieClip;
public var power:Power;
public var presentation:Presentation;
public var combolist:Array;
public var resetTimer:Timer;
public var messageQueue:Array;
public var movingstage:Boolean;// = false
public var fader:MovieClip;
public var onpause:Boolean;// = false
public var frontSet:MovieClip;
public var faderLayer:MovieClip;
public var TOASIDE;// = 4
public var level:int;// = 1
public var xpmeter:XPMeter;
public var timeframes:int;// = 0
public var gameover:GameOver;
public var movedlist:Array;
public var scoreLayer:MovieClip;
public function Board(){
STARTINGLEFT = (215 - 30);
STARTINGTOP = (((95 + 30) + 50) + 30);
TOASIDE = 4;
xptonextlevel = 5;
level = 1;
timeleft = 180;
timeframes = 0;
totalactivations = 0;
movingstage = false;
onpause = false;
super();
bgLayer = new MovieClip();
boardLayer = new MovieClip();
pieceLayer = new MovieClip();
chuteLayer = new MovieClip();
scoreLayer = new MovieClip();
faderLayer = new MovieClip();
backSet = new MovieClip();
frontSet = new MovieClip();
this.addChild(backSet);
this.addChild(frontSet);
backSet.addChild(bgLayer);
backSet.addChild(boardLayer);
backSet.addChild(pieceLayer);
backSet.addChild(chuteLayer);
backSet.addChild(scoreLayer);
backSet.addChild(faderLayer);
bg = new BoardBackground();
bg.x = (550 / 2);
bg.y = (600 / 2);
bgLayer.addChild(bg);
presentation = new Presentation(this);
presentation.x = 25;
presentation.y = 55;
frontSet.addChild(presentation);
powerserver = new PowerServer();
powerserver.setBoard(this);
frontSet.addChild(powerserver);
power = new Power();
power.setBoard(this);
messageQueue = new Array();
assembleBoard();
trace((("after assembleBoard, pieceLayer has " + pieceLayer.numChildren) + " pieces"));
finalScore = new ScoreField();
finalScore.x = (550 / 2);
finalScore.y = 2;
scoreLayer.addChild(finalScore);
combolist = new Array();
movedlist = new Array();
fader = new Fader();
faderLayer.addChild(fader);
gameover = new GameOver();
gameover.x = 0;
gameover.y = 0;
gameover.visible = false;
gameover.gotoAndStop(1);
frontSet.addChild(gameover);
xpcountdown = new XPCountdown();
xpcountdown.x = 120;
xpcountdown.y = 500;
xpcountdown.scaleX = 1.2;
xpcountdown.scaleY = 1.2;
scoreLayer.addChild(xpcountdown);
xpmeter = new XPMeter();
xpmeter.x = 535;
xpmeter.y = 560;
xpmeter.update(xptonextlevel, level);
scoreLayer.addChild(xpmeter);
scoreLayer.mouseEnabled = false;
scoreLayer.mouseChildren = false;
messageQueue.push(["intro", 80, false]);
fader.gotoAndPlay("fulltohalf");
addEventListener("enterFrame", onFrame);
}
public function assembleBoard(){
var _local1:*;
var _local2:*;
var _local3:*;
var _local4:*;
var _local5:*;
var _local6:*;
_local3 = 0;
_local4 = [90, 180, 270, 0];
tilearray = new Array();
_local5 = 0;
while (_local5 < TOASIDE) {
tilearray.push(new Array(TOASIDE));
_local5++;
};
piecelist = new Array();
_local1 = 0;
while (_local1 < TOASIDE) {
_local2 = 0;
while (_local2 < TOASIDE) {
_local6 = new Tile();
_local6.setFrame(((_local3)==0) ? "white" : "black");
_local3 = !(_local3);
_local6.x = (STARTINGLEFT + (_local2 * 60));
_local6.y = (STARTINGTOP + (_local1 * 60));
_local6.square.rotation = _local4[Math.floor((Math.random() * 4))];
if (_local2 != 0){
_local6.bracel.visible = false;
};
if (_local2 != (TOASIDE - 1)){
_local6.bracer.visible = false;
};
if (_local1 != 0){
_local6.braceu.visible = false;
};
if (_local1 != (TOASIDE - 1)){
_local6.braced.visible = false;
};
tilearray[_local1][_local2] = _local6;
boardLayer.addChild(_local6);
_local2++;
};
_local3 = !(_local3);
_local1++;
};
assembleChutesAndFeeds();
}
public function onGameOverFinished(_arg1:Event){
}
public function getTileAt(_arg1:int, _arg2:int):Tile{
if (outOfBounds(_arg1, _arg2)){
return (null);
};
return (tilearray[_arg1][_arg2]);
}
public function explodePiece(_arg1:Piece){
var _local2:int;
var _local3:MovieClip;
_local2 = 0;
_local2 = (_local2 + Math.floor((Math.random() * 10)));
while (_local2 < 360) {
_local3 = new PieceVanish();
if ((_local2 % 2) == 0){
_local3.gotoAndPlay("motion1");
} else {
_local3.gotoAndPlay("motion2");
};
_local3.x = _arg1.x;
_local3.y = _arg1.y;
_local3.rotation = _local2;
pieceLayer.addChild(_local3);
_local2 = (_local2 + Math.floor(((Math.random() * 20) + 21)));
};
}
public function onFrame(_arg1:Event){
var _local2:int;
var _local3:int;
var _local4:Array;
var _local5:*;
var _local6:*;
var _local7:int;
var _local8:Sound;
var _local9:Combo;
var _local10:Piece;
var _local11:Array;
var _local12:Piece;
var _local13:Combo;
var _local14:int;
var _local15:int;
var _local16:Object;
var _local17:Piece;
var _local18:*;
var _local19:*;
var _local20:Piece;
var _local21:Object;
var _local22:int;
var _local23:Combo;
bg.rotation = (bg.rotation + (360 / (360 * 5)));
if (bg.rotation > 360){
bg.rotation = (bg.rotation - 360);
};
if ((((messageQueue.length > 0)) && ((onpause == false)))){
pauseGame(true, messageQueue[0][2]);
presentation.startPresentation(messageQueue[0][0], messageQueue[0][1]);
};
if (onpause){
return;
};
timeframes++;
if (timeframes > 30){
timeframes = (timeframes - 30);
timeleft--;
xpmeter.timeUpdate(timeleft);
if (timeleft < 60){
_local8 = new SoundTimeIsShort();
_local8.play();
};
};
if (timeleft <= 0){
gameOver(false);
return;
};
movingstage = false;
_local2 = 0;
while (_local2 < piecelist.length) {
piecelist[_local2].move();
if (piecelist[_local2].moving == true){
movingstage = true;
};
_local2++;
};
if (movingstage == true){
return;
};
_local3 = 0;
while (_local3 < combolist.length) {
_local9 = combolist[_local3];
_local9.combocountdown--;
if (_local9.combocountdown <= 0){
releaseCombo(_local9);
} else {
_local2 = 0;
while (_local2 < _local9.piecelist.length) {
_local10 = _local9.piecelist[_local2];
_local10.sizeCountdown(_local9.combocountdown, _local9.maxcountdown);
_local2++;
};
};
_local3++;
};
_local4 = [[0, 1], [0, -1], [1, 0], [-1, 0], [1, 1], [-1, -1], [-1, 1], [1, -1]];
_local5 = 0;
while (_local5 < movedlist.length) {
_local12 = movedlist[_local5];
_local13 = new Combo(_local12.symbol);
_local11 = new Array();
_local15 = 4;
if (power.powerDiagonal){
_local15 = 8;
};
_local14 = 0;
while (_local14 < _local15) {
if ((_local14 % 2) == 0){
_local11 = new Array();
_local11.push(_local12);
};
_local16 = getRowColumnOfPiece(_local12);
while (outOfBounds(_local16.r, _local16.c) == false) {
_local17 = getPieceAt(_local16.r, _local16.c);
if (_local17 == null){
break;
};
if (((!((_local17.symbol == _local12.symbol))) || (!((isComboing(_local17) == null))))){
break;
} else {
if (_local17 != _local12){
_local11.push(_local17);
};
};
_local16.r = (_local16.r + _local4[_local14][0]);
_local16.c = (_local16.c + _local4[_local14][1]);
};
if ((_local14 % 2) == 1){
if (_local11.length >= 3){
_local18 = 0;
while (_local18 < _local11.length) {
_local13.addPiece(_local11[_local18]);
_local13.piecetype = _local12.symbol;
_local18++;
};
};
};
_local14++;
};
if (_local13.piecelist.length >= 3){
trace((("New combo of " + _local13.piecelist.length) + " pieces"));
combolist.push(_local13);
_local19 = 0;
while (_local19 < _local13.piecelist.length) {
_local13.piecelist[_local19].comboOn();
_local19++;
};
};
_local5++;
};
movedlist = new Array();
_local6 = 0;
while (_local6 < TOASIDE) {
_local7 = 0;
while (_local7 < TOASIDE) {
_local20 = getPieceAt(_local6, _local7);
if (_local20 == null){
} else {
if (isComboing(_local20)){
} else {
_local21 = getRowColumnOfPiece(_local20);
_local22 = 4;
if (power.powerDiagonal){
_local22 = 8;
};
_local14 = 0;
while (_local14 < _local22) {
_local17 = getPieceAt((_local21.r + _local4[_local14][0]), (_local21.c + _local4[_local14][1]));
if (_local17 != null){
if (((!((isComboing(_local17) == null))) && ((_local17.symbol == _local20.symbol)))){
_local23 = isComboing(_local17);
_local23.addPiece(_local20);
_local20.comboOn();
break;
};
};
_local14++;
};
};
};
_local7++;
};
_local6++;
};
if ((((combolist.length == 0)) && ((piecelist.length == ((TOASIDE * TOASIDE) + (TOASIDE * 4)))))){
gameOver(false);
};
}
public function earnXP(){
if (xptonextlevel > 0){
xptonextlevel--;
xpcountdown.flash(xptonextlevel);
xpmeter.update(xptonextlevel, level);
if (xptonextlevel <= 0){
if (level >= 10){
gameOver(true);
} else {
pauseGame(true, true);
powerserver.move(power.getNextPowers());
};
};
};
}
public function onClickBackSet(_arg1:Event){
var _local2:Chute;
var _local3:Piece;
var _local4:Object;
var _local5:*;
var _local6:Sound;
var _local7:int;
var _local8:Piece;
if ((_arg1.target is Chute)){
trace("Chute click");
if (movingstage == true){
return;
};
_local2 = Chute(_arg1.target);
_local3 = _local2.feed[_local2.index];
_local4 = getShootingInfo(_local2);
if (_local4.result == "no"){
_local6 = new SoundNotAllowed();
_local6.play();
};
if (_local4.result != "no"){
if (power.powerGamble2 == false){
_local3.gambled = true;
_local3.twinkle.visible = false;
};
_local6 = new SoundChuteThrow();
_local6.play();
};
movedlist = new Array();
if (_local4.result == "free"){
_local3.setDestToDestOf(_local4.finalplace, 45);
movedlist.push(_local3);
adjustFeedRemoval(_local2.feed, _local2.index);
};
if (_local4.result == "push"){
_local7 = 0;
while (_local7 < _local4.pushlist.length) {
_local8 = _local4.pushlist[_local7];
_local8.setShift(_local2.rowdir, _local2.coldir);
movedlist.push(_local8);
_local7++;
};
_local3.setDestToDestOf(_local4.finalplace, 10);
movedlist.push(_local3);
adjustFeedRemoval(_local2.feed, _local2.index);
};
_local5 = 0;
while (_local5 < movedlist.length) {
movedlist[_local5].activationorder = totalactivations;
totalactivations++;
_local5++;
};
};
}
public function outOfBounds(_arg1:int, _arg2:int):Boolean{
if ((((_arg1 < 0)) || ((_arg1 > (TOASIDE - 1))))){
return (true);
};
if ((((_arg2 < 0)) || ((_arg2 > (TOASIDE - 1))))){
return (true);
};
return (false);
}
public function getRowColumnOfPiece(_arg1:Piece):Object{
var _local2:Object;
var _local3:*;
var _local4:int;
var _local5:Tile;
_local2 = new Object();
_local2.r = -1;
_local2.c = -1;
_local3 = 0;
while (_local3 <= (TOASIDE - 1)) {
_local4 = 0;
while (_local4 <= (TOASIDE - 1)) {
_local5 = getTileAt(_local3, _local4);
if ((((_local5.x == _arg1.x)) && ((_local5.y == _arg1.y)))){
_local2.r = _local3;
_local2.c = _local4;
return (_local2);
};
_local4++;
};
_local3++;
};
return (_local2);
}
public function isComboing(_arg1:Piece):Combo{
var _local2:int;
var _local3:Combo;
var _local4:int;
_local2 = 0;
while (_local2 < combolist.length) {
_local3 = combolist[_local2];
_local4 = 0;
while (_local4 < _local3.piecelist.length) {
if (_local3.piecelist[_local4] == _arg1){
return (_local3);
};
_local4++;
};
_local2++;
};
return (null);
}
public function assembleChutesAndFeeds(){
var _local1:Tile;
var _local2:*;
var _local3:*;
var _local4:*;
var _local5:Tile;
var _local6:Tile;
feedu = new Array();
feedd = new Array();
feedl = new Array();
feedr = new Array();
_local1 = getTileAt(0, 0);
_local2 = 0;
while (_local2 < TOASIDE) {
_local3 = new Chute();
_local3.x = (_local1.x + (_local2 * 60));
_local3.y = (_local1.y - 55);
_local3.setFeed(feedu, _local2);
_local3.setEntrance(0, _local2, 1, 0);
_local3.rotation = 0;
chuteLayer.addChild(_local3);
_local3.addEventListener("click", onClickBackSet);
_local4 = new Piece(this);
_local4.x = _local3.x;
_local4.y = (_local3.y - 25);
_local4.rootInPlace();
pieceLayer.addChild(_local4);
feedu.push(_local4);
_local2++;
};
_local5 = getTileAt((TOASIDE - 1), 0);
_local2 = 0;
while (_local2 < TOASIDE) {
_local3 = new Chute();
_local3.x = (_local5.x + (_local2 * 60));
_local3.y = (_local5.y + 55);
_local3.setFeed(feedd, _local2);
_local3.setEntrance((TOASIDE - 1), _local2, -1, 0);
_local3.rotation = 180;
chuteLayer.addChild(_local3);
_local3.addEventListener("click", onClickBackSet);
_local4 = new Piece(this);
_local4.x = _local3.x;
_local4.y = (_local3.y + 25);
_local4.rootInPlace();
pieceLayer.addChild(_local4);
feedd.push(_local4);
_local2++;
};
_local2 = 0;
while (_local2 < TOASIDE) {
_local3 = new Chute();
_local3.x = (_local1.x - 55);
_local3.y = (_local1.y + (_local2 * 60));
_local3.setFeed(feedl, _local2);
_local3.setEntrance(_local2, 0, 0, 1);
_local3.rotation = 270;
chuteLayer.addChild(_local3);
_local3.addEventListener("click", onClickBackSet);
_local4 = new Piece(this);
_local4.x = (_local3.x - 25);
_local4.y = _local3.y;
_local4.rootInPlace();
pieceLayer.addChild(_local4);
feedl.push(_local4);
_local2++;
};
_local6 = getTileAt(0, (TOASIDE - 1));
_local2 = 0;
while (_local2 < TOASIDE) {
_local3 = new Chute();
_local3.x = (_local6.x + 55);
_local3.y = (_local6.y + (_local2 * 60));
_local3.setFeed(feedr, _local2);
_local3.setEntrance(_local2, (TOASIDE - 1), 0, -1);
_local3.rotation = 90;
chuteLayer.addChild(_local3);
_local3.addEventListener("click", onClickBackSet);
_local4 = new Piece(this);
_local4.x = (_local3.x + 25);
_local4.y = _local3.y;
_local4.rootInPlace();
pieceLayer.addChild(_local4);
feedr.push(_local4);
_local2++;
};
}
public function pauseGame(_arg1:Boolean, _arg2:Boolean){
if (onpause == _arg1){
return;
};
onpause = _arg1;
if (_arg2 == true){
if (_arg1){
fader.gotoAndPlay("nonetohalf");
} else {
fader.gotoAndPlay("halftonone");
};
};
}
public function getShootingInfo(_arg1:Chute):Object{
var _local2:String;
var _local3:Array;
var _local4:MovieClip;
var _local5:*;
var _local6:int;
var _local7:Object;
var _local8:int;
var _local9:int;
var _local10:Piece;
_local2 = "free";
_local3 = new Array();
if ((getPieceAt(_arg1.entrancer, _arg1.entrancec) is Piece)){
_local2 = "no";
_local8 = _arg1.entrancer;
_local9 = _arg1.entrancec;
while (outOfBounds(_local8, _local9) == false) {
if ((getPieceAt(_local8, _local9) is Piece)){
_local10 = getPieceAt(_local8, _local9);
_local3.push(_local10);
if (((!((isComboing(_local10) == null))) && ((power.powerSpreading == false)))){
_local2 = "no";
break;
};
};
if (getPieceAt(_local8, _local9) == null){
_local2 = "push";
break;
};
_local8 = (_local8 + _arg1.rowdir);
_local9 = (_local9 + _arg1.coldir);
};
};
if (_local2 == "push"){
_local4 = getTileAt(_arg1.entrancer, _arg1.entrancec);
_local5 = _arg1.entrancer;
_local6 = _arg1.entrancec;
};
if (_local2 == "free"){
_local8 = _arg1.entrancer;
_local9 = _arg1.entrancec;
_local4 = null;
while (outOfBounds(_local8, _local9) == false) {
if ((getPieceAt(_local8, _local9) is Piece)){
_local4 = getTileAt((_local8 - _arg1.rowdir), (_local9 - _arg1.coldir));
_local5 = (_local8 - _arg1.rowdir);
_local6 = (_local9 - _arg1.coldir);
break;
};
_local8 = (_local8 + _arg1.rowdir);
_local9 = (_local9 + _arg1.coldir);
};
if (_local4 == null){
_local4 = getTileAt((_local8 - _arg1.rowdir), (_local9 - _arg1.coldir));
_local5 = (_local8 - _arg1.rowdir);
_local6 = (_local9 - _arg1.coldir);
};
};
_local7 = new Object();
_local7.finalplace = _local4;
_local7.pushlist = _local3;
_local7.result = _local2;
_local7.finalr = _local5;
_local7.finalc = _local6;
return (_local7);
}
public function adjustFeedRemoval(_arg1:Array, _arg2:int){
var _local3:Boolean;
var _local4:int;
var _local5:int;
var _local6:*;
var _local7:Number;
var _local8:Piece;
_local3 = false;
if ((((_arg1 == feedu)) || ((_arg1 == feedd)))){
_local3 = true;
};
_local4 = 1;
_local5 = _arg2;
_local5 = (_local5 + _local4);
_local6 = _arg1[_arg2].x;
_local7 = _arg1[_arg2].y;
while ((((_local5 >= 0)) && ((_local5 <= (TOASIDE - 1))))) {
_local6 = _arg1[_local5].x;
_local7 = _arg1[_local5].y;
_arg1[_local5].setShift((_local3) ? 0 : (_local4 * -1), (_local3) ? (_local4 * -1) : 0);
_local5 = (_local5 + _local4);
};
_arg1.splice(_arg2, 1);
_local8 = new Piece(this);
_local8.x = _local6;
_local8.y = _local7;
_local8.rootInPlace();
_local8.startFadeIn();
pieceLayer.addChild(_local8);
if (_local3){
_local8.x = (_local8.x + (60 * _local4));
_local8.setShift(0, (-1 * _local4));
} else {
_local8.y = (_local8.y + (60 * _local4));
_local8.setShift((-1 * _local4), 0);
};
if (_local4 == 1){
_local8.setRandom([_arg1[(_arg1.length - 1)]]);
_arg1.push(_local8);
} else {
_local8.setRandom([_arg1[0]]);
_arg1.unshift(_local8);
};
}
public function setxpForNextLevel():int{
xptonextlevel = (5 + ((level - 1) * 5));
if (xptonextlevel > 50){
xptonextlevel = 50;
};
return (xptonextlevel);
}
public function getPieceAt(_arg1:int, _arg2:int):Piece{
var _local3:Tile;
var _local4:Number;
var _local5:Number;
var _local6:Piece;
var _local7:int;
var _local8:Piece;
if (outOfBounds(_arg1, _arg2)){
return (undefined);
};
_local3 = getTileAt(_arg1, _arg2);
_local4 = _local3.x;
_local5 = _local3.y;
_local6 = null;
_local7 = 0;
while (_local7 < piecelist.length) {
_local8 = piecelist[_local7];
if ((((_local8.x == _local4)) && ((_local8.y == _local5)))){
_local6 = _local8;
break;
};
_local7++;
};
if (_local6 == null){
return (null);
};
return (_local6);
}
public function announceScore(_arg1:int, _arg2:MovieClip){
scoreLayer.addChild(new ScoreAppear(_arg1, _arg2.x, _arg2.y, this));
}
public function releaseCombo(_arg1:Combo){
var _local2:*;
var _local3:int;
var _local4:int;
var _local5:Sound;
var _local6:*;
var _local7:Tile;
var _local8:Piece;
var _local9:Tile;
finalScore.addScore(_arg1.accumulatedScore);
Main.konPublicSubmit("High Combo Score", _arg1.accumulatedScore);
combolist.splice(combolist.indexOf(_arg1), 1);
Main.konPublicSubmit("High Combo Count", _arg1.piecelist.length);
if ((((_arg1.piecelist.length >= 6)) && ((power.powerPurifierTile == true)))){
_local2 = 0;
while (_local2 < _arg1.piecelist.length) {
_local6 = getRowColumnOfPiece(_arg1.piecelist[_local2]);
_local7 = getTileAt(_local6.r, _local6.c);
if (_local7 != null){
_local7.purify();
};
_local2++;
};
};
_local2 = 0;
while (_local2 < _arg1.piecelist.length) {
_local8 = _arg1.piecelist[_local2];
piecelist.splice(piecelist.indexOf(_local8), 1);
explodePiece(_local8);
pieceLayer.removeChild(_local8);
_local2++;
};
_local3 = 0;
_local4 = 0;
_local2 = 0;
while (_local2 <= 3) {
_local4 = 0;
while (_local4 <= 3) {
_local9 = tilearray[_local2][_local4];
if (_local9.ispurified){
_local3++;
};
_local4++;
};
_local2++;
};
if (_local3 > 0){
Main.konPublicSubmit("Whitened Tiles", _local3);
};
if (_arg1.soundChannel != null){
_arg1.soundChannel.stop();
};
_local5 = new SoundPiecesUpInSmoke();
_local5.play();
}
public function gameOver(_arg1:Boolean){
removeEventListener("enterFrame", onFrame);
fader.gotoAndPlay("nonetofull");
gameover.visible = true;
if (_arg1 == false){
if (timeleft <= 0){
gameover.gotoAndPlay("timeout");
} else {
gameover.gotoAndPlay("lost");
};
} else {
gameover.gotoAndPlay("won");
};
frontSet.addChild(finalScore);
Main.konPublicSubmit("High Score", finalScore.total);
if (_arg1 == true){
Main.konPublicSubmit("All Clear", 1);
};
}
public function chosePower(_arg1:PowerEntry){
power.invoke(_arg1);
Main.konPublicSubmit("Level Complete", level);
level++;
setxpForNextLevel();
timeleft = 180;
timeframes = 0;
xpmeter.update(xptonextlevel, level);
xpmeter.timeUpdate(timeleft);
messageQueue.push([_arg1.title, 5, true]);
pauseGame(false, true);
powerserver.move([]);
}
}
}//package
Section 2
//BoardBackground (BoardBackground)
package {
import flash.display.*;
public dynamic class BoardBackground extends MovieClip {
}
}//package
Section 3
//Chute (Chute)
package {
import flash.display.*;
public dynamic class Chute extends MovieClip {
public var coldir:int;
public var entrancec:int;
public var entrancer:int;
public var rowdir:int;
public var feed:Array;
public var index:int;
public function setFeed(_arg1:Array, _arg2:int){
feed = _arg1;
index = _arg2;
}
public function setEntrance(_arg1, _arg2, _arg3, _arg4:int){
entrancer = _arg1;
entrancec = _arg2;
rowdir = _arg3;
coldir = _arg4;
}
}
}//package
Section 4
//Combo (Combo)
package {
import flash.events.*;
import flash.media.*;
import flash.display.*;
import flash.text.*;
public class Combo {
public var combocountdown:int;
public var piecetype:String;
public var piecelist:Array;
public var maxcountdown:int;
public var soundChannel:SoundChannel;// = null
public var accumulatedScore:int;// = 0
public function Combo(_arg1:String){
accumulatedScore = 0;
soundChannel = null;
super();
piecelist = new Array();
piecetype = _arg1;
combocountdown = 90;
maxcountdown = 90;
}
public function addPiece(_arg1:Piece){
var _local2:Boolean;
var _local3:*;
var _local4:Board;
var _local5:*;
var _local6:int;
var _local7:*;
var _local8:Tile;
_local2 = false;
_local3 = 0;
while (_local3 < piecelist.length) {
if (piecelist[_local3] == _arg1){
_local2 = true;
break;
};
_local3++;
};
if (_local2 == false){
piecelist.push(_arg1);
_local4 = _arg1.board;
if (_local4.power.powerIncreasedComboTime){
if (combocountdown == maxcountdown){
combocountdown = 180;
};
maxcountdown = 180;
};
if (_local4.power.powerIncreasedComboTime2){
if (combocountdown == maxcountdown){
combocountdown = 270;
};
maxcountdown = 270;
};
piecelist.sortOn(["marked", "activationorder"]);
if (piecelist.length >= 3){
_local5 = [0, 0, 0, 100, 200, 400, 800, 1600, 3200, 0x1900, 0x3200, 0x6400, 0xC800, 102400, 204800, 409600, 819200, (819200 * 2), (819200 * 4)];
_local6 = 1;
if (_local4.power.powerNoMoreOmega){
_local6 = 2;
};
if (((_local4.power.powerOmegaPremium) && ((_arg1.symbol == "omega")))){
_local6 = 10;
};
_local7 = _local4.getRowColumnOfPiece(_arg1);
_local8 = _local4.getTileAt(_local7.r, _local7.c);
if (_local8 != null){
if ((((_local4.power.powerPurifierTile == true)) && ((_local8.ispurified == true)))){
_local6 = (_local6 * 2);
};
};
accumulatedScore = (accumulatedScore + (_local5[piecelist.length] * _local6));
piecelist[(piecelist.length - 1)].board.announceScore((_local5[piecelist.length] * _local6), piecelist[(piecelist.length - 1)]);
piecelist[(piecelist.length - 1)].marked--;
_arg1.board.earnXP();
if (_local4.power.powerComboRefresh){
combocountdown = maxcountdown;
};
if (soundChannel == null){
soundChannel = new SoundComboLoop().play(0, 2000);
};
};
};
}
}
}//package
Section 5
//DarkLevelMark (DarkLevelMark)
package {
import flash.display.*;
public dynamic class DarkLevelMark extends MovieClip {
}
}//package
Section 6
//Fader (Fader)
package {
import flash.display.*;
public dynamic class Fader extends MovieClip {
public var fulltonone:MovieClip;
public function Fader(){
addFrameScript(0, frame1, 29, frame30, 30, frame31, 59, frame60, 60, frame61, 89, frame90, 90, frame91, 119, frame120, 120, frame121, 150, frame151);
}
function frame151(){
stop();
}
function frame90(){
stop();
}
function frame91(){
this.visible = true;
}
function frame1(){
this.visible = true;
}
function frame30(){
this.visible = false;
stop();
}
function frame31(){
this.visible = true;
}
function frame120(){
this.visible = false;
stop();
}
function frame121(){
this.visible = true;
}
function frame61(){
this.visible = true;
}
function frame60(){
stop();
}
}
}//package
Section 7
//GameOver (GameOver)
package {
import flash.events.*;
import flash.media.*;
import flash.display.*;
public dynamic class GameOver extends MovieClip {
public var replay:SimpleButton;
public function GameOver(){
addFrameScript(29, frame30, 60, frame61, 91, frame92);
}
public function onClickReplayWell(_arg1:Event){
var _local2:Sound;
_local2 = new SoundLetsPlay();
_local2.play();
Main.restartGame();
}
public function onClickReplay(_arg1:Event){
var _local2:Sound;
_local2 = new SoundLetsPlay();
_local2.play();
Main.restartGame();
}
function frame92(){
stop();
replay.addEventListener("click", onClickReplayQuickly);
}
function frame30(){
stop();
replay.addEventListener("click", onClickReplay);
}
function frame61(){
stop();
replay.addEventListener("click", onClickReplayWell);
}
public function onClickReplayQuickly(_arg1:Event){
var _local2:Sound;
_local2 = new SoundLetsPlay();
_local2.play();
Main.restartGame();
}
}
}//package
Section 8
//LevelMark (LevelMark)
package {
import flash.display.*;
public dynamic class LevelMark extends MovieClip {
}
}//package
Section 9
//Main (Main)
package {
import flash.events.*;
import flash.media.*;
import flash.display.*;
import flash.utils.*;
import flash.net.*;
import flash.system.*;
import flash.ui.*;
public dynamic class Main extends MovieClip {
public var startButton:SimpleButton;
public var goToSite:SimpleButton;
public var bd;
public var board:Board;
public static var kongregate = null;
public static var singleton:Main;
public static var soundChannel:SoundChannel;
public function Main(){
var _local1:ContextMenu;
super();
addFrameScript(0, frame1, 5, frame6, 35, frame36, 110, frame111);
_local1 = new ContextMenu();
_local1.hideBuiltInItems();
this.contextMenu = _local1;
singleton = this;
Main.contactKongregate();
}
function clone(_arg1:Object){
var _local2:ByteArray;
_local2 = new ByteArray();
_local2.writeObject(_arg1);
_local2.position = 0;
return (_local2.readObject());
}
function frame6(){
gotoAndPlay("beginning");
}
function frame1(){
stop();
}
function frame36(){
stop();
startButton.addEventListener("click", onClick);
goToSite.addEventListener("click", onClickSite);
}
function frame111(){
bd = new Board();
Main.singleton.board = bd;
this.addChild(bd);
stop();
}
public function onClickSite(_arg1:Event){
navigateToURL(new URLRequest("http://www.kinsmangames.com"));
}
public function onClick(_arg1:Event){
var _local2:Sound;
_local2 = new SoundLetsPlay();
_local2.play();
play();
}
public static function restartGame(){
var _local1:int;
while (singleton.numChildren > 0) {
singleton.removeChildAt(0);
};
singleton.gotoAndPlay("beginning");
_local1 = 0;
while (_local1 < singleton.board.combolist.length) {
singleton.board.combolist[_local1].soundChannel.stop();
_local1++;
};
singleton.stopAllSounds();
}
public static function setTheme(_arg1:Sound){
if (soundChannel != null){
soundChannel.stop();
};
soundChannel = _arg1.play(0, 2000, null);
}
public static function konLoadComplete(_arg1:Event){
var event = _arg1;
try {
Main.kongregate = event.target.content;
Main.kongregate.services.connect();
} catch(e:Error) {
Main.kongregate = null;
};
}
public static function konPublicSubmit(_arg1:String, _arg2:int){
if (Main.kongregate == null){
return;
};
Main.kongregate.stats.submit(_arg1, _arg2);
Main.kongregate.scores.setMode(_arg1);
Main.kongregate.scores.submit(_arg2);
}
public static function stopTheme(){
if (soundChannel != null){
soundChannel.stop();
};
}
public static function konPrivateSubmit(_arg1:String, _arg2:int){
if (Main.kongregate == null){
return;
};
Main.kongregate.stats.submit(_arg1, _arg2);
}
public static function preloaderDone(){
singleton.play();
}
public static function contactKongregate(){
var paramObj:Object;
var api_url:String;
var request:URLRequest;
var loader:Loader;
paramObj = Main.singleton.loaderInfo.parameters;
api_url = ((paramObj.api_path) || ("http://www.kongregate.com/flash/API_AS3_Local.swf"));
trace(("API path: " + api_url));
try {
request = new URLRequest(api_url);
loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, Main.konLoadComplete);
loader.load(request);
Main.singleton.addChild(loader);
} catch(e:Error) {
Main.kongregate = null;
};
}
}
}//package
Section 10
//Piece (Piece)
package {
import flash.events.*;
import flash.media.*;
import flash.display.*;
import flash.text.*;
public dynamic class Piece extends MovieClip {
public var desty:Number;
public var destx:Number;
public var countdown:MovieClip;
public var marked:int;// = 0
public var twinkle:MovieClip;
public var moving:Boolean;
public var speed:Number;
public var symbol:String;
public var flasher:MovieClip;
public var gambled:Boolean;
public var movex:Number;
public var movey:Number;
public var circle:MovieClip;
public var lowerspeed:Number;
public var board:Board;
public var activationorder:Number;// = 0
public static var previoussymbol:String = "delta";
public function Piece(_arg1:Board){
activationorder = 0;
marked = 0;
super();
board = _arg1;
setRandom();
movex = 0;
movey = 0;
speed = 0;
_arg1.piecelist.push(this);
flasher.visible = false;
countdown.visible = false;
gambled = false;
twinkle.visible = false;
if (board.power.powerGamble == true){
twinkle.visible = true;
};
addEventListener("click", onPieceClick);
}
public function comboOn(){
flasher.visible = true;
countdown.visible = true;
}
public function onFadeFrame(_arg1:Event){
this.alpha = (this.alpha + 0.05);
if (this.alpha >= 1){
removeEventListener("enterFrame", onFadeFrame);
};
}
public function sizeCountdown(_arg1, _arg2:int){
countdown.scaleX = (_arg1 / _arg2);
countdown.scaleY = (_arg1 / _arg2);
}
public function setShift(_arg1, _arg2:int){
destx = (this.x + (60 * _arg2));
desty = (this.y + (60 * _arg1));
movex = _arg2;
movey = _arg1;
speed = 10;
lowerspeed = 5;
moving = true;
}
public function onPieceClick(_arg1:Event){
var _local2:int;
var _local3:*;
_local2 = 0;
_local3 = 0;
while (_local3 < board.piecelist.length) {
if (board.piecelist[_local3] == this){
_local2 = _local3;
break;
};
_local3++;
};
trace(((((((("Clicked on a piece " + circle.currentLabel) + ", found at position ") + _local2) + " and xy is ") + this.x) + ",") + this.y));
trace((((("board.piecelist has " + board.piecelist.length) + " pieces, board.pieceLayer has ") + board.pieceLayer.numChildren) + " pieces"));
if ((((board.power.powerGamble == true)) && ((gambled == false)))){
gambled = true;
twinkle.visible = false;
setRandom();
};
}
public function rootInPlace(){
destx = x;
desty = y;
moving = false;
}
public function setRandom(_arg1:Array=null){
var _local2:*;
var _local3:int;
var _local4:Boolean;
var _local5:*;
_local2 = ["delta", "summa", "pi", "beta", "omega"];
this.symbol = _local2[Math.floor((Math.random() * (_local2.length - (board.power.powerNoMoreOmega) ? 1 : 0)))];
_local3 = 0;
if (_arg1 == null){
while (this.symbol == Piece.previoussymbol) {
_local3++;
this.symbol = _local2[Math.floor((Math.random() * (_local2.length - (board.power.powerNoMoreOmega) ? 1 : 0)))];
if (_local3 > 5){
break;
};
};
} else {
while (_local3 < 5) {
_local3++;
_local4 = false;
_local5 = 0;
while (_local5 < _arg1.length) {
if (_arg1[_local5].symbol == this.symbol){
_local4 = true;
break;
};
_local5++;
};
if (_local4 == false){
break;
} else {
this.symbol = _local2[Math.floor((Math.random() * (_local2.length - (board.power.powerNoMoreOmega) ? 1 : 0)))];
};
};
};
if ((((this.symbol == "omega")) && ((Math.random() < 0.5)))){
this.symbol = _local2[Math.floor((Math.random() * (_local2.length - (board.power.powerNoMoreOmega) ? 1 : 0)))];
};
circle.gotoAndStop(this.symbol);
Piece.previoussymbol = this.symbol;
}
public function startFadeIn(){
this.alpha = 0;
addEventListener("enterFrame", onFadeFrame);
}
public function move(){
var _local1:Sound;
if (moving == true){
x = (x + (movex * speed));
y = (y + (movey * speed));
speed = (speed - ((speed - lowerspeed) / 10));
if (speed < lowerspeed){
speed = lowerspeed;
};
if (movex > 0){
if (x >= destx){
x = destx;
moving = false;
};
};
if (movex < 0){
if (x <= destx){
x = destx;
moving = false;
};
};
if (movey > 0){
if (y >= desty){
y = desty;
moving = false;
};
};
if (movey < 0){
if (y <= desty){
y = desty;
moving = false;
};
};
if ((((moving == false)) && ((speed > 12)))){
_local1 = new SoundPieceTap();
_local1.play();
};
};
}
public function setDestToDestOf(_arg1:MovieClip, _arg2:int){
destx = _arg1.x;
desty = _arg1.y;
if (destx < this.x){
movex = -1;
};
if (destx == this.x){
movex = 0;
};
if (destx > this.x){
movex = 1;
};
if (desty < this.y){
movey = -1;
};
if (desty == this.y){
movey = 0;
};
if (desty > this.y){
movey = 1;
};
speed = _arg2;
lowerspeed = (_arg2 / 2);
moving = true;
}
}
}//package
Section 11
//PieceVanish (PieceVanish)
package {
import flash.display.*;
public dynamic class PieceVanish extends MovieClip {
public function PieceVanish(){
addFrameScript(29, frame30, 59, frame60);
}
function frame30(){
stop();
this.parent.removeChild(this);
}
function frame60(){
stop();
this.parent.removeChild(this);
}
}
}//package
Section 12
//Power (Power)
package {
import flash.events.*;
import flash.display.*;
import flash.text.*;
public class Power {
public var powerGamble2:Boolean;// = false
public var powerNoMoreOmega:Boolean;// = false
public var powerEmpty:Boolean;// = false
public var powerGamble:Boolean;// = false
public var powerSpreading:Boolean;// = false
public var powerComboRefresh:Boolean;// = false
public var powerIncreasedComboTime2:Boolean;// = false
public var powerDiagonal:Boolean;// = false
public var powerIncreasedComboTime:Boolean;// = false
public var powerPurifierTile:Boolean;// = false
public var powerOmegaPremium:Boolean;// = false
public var board:Board;
public var powerarray;
public var powerUnclog:Boolean;// = false
public function Power(){
powerarray = [new PowerEntry("Piece Gamble", 1, "", "powerGamble", "implAddTwinkle"), new PowerEntry("On-Board Gamble", 3, "powerGamble", "powerGamble2", ""), new PowerEntry("Empty The Board", 1, "", "powerEmpty", "implEmptyBoard"), new PowerEntry("Unclog The Board", 2, "powerEmpty", "powerUnclog", "implUnclogBoard"), new PowerEntry("Combo Spreading", 6, "", "powerSpreading", ""), new PowerEntry("Increased Combo Time", 1, "", "powerIncreasedComboTime", ""), new PowerEntry("Increased Combo Time II", 4, "powerIncreasedComboTime", "powerIncreasedComboTime2", ""), new PowerEntry("Combo Refresh", 3, "", "powerComboRefresh", ""), new PowerEntry("Diagonals", 3, "", "powerDiagonal", ""), new PowerEntry("Omega Premium", 1, "", "powerOmegaPremium", ""), new PowerEntry("No More Omega", 3, "powerOmegaPremium", "powerNoMoreOmega", "implRemoveOmega"), new PowerEntry("Whitening Tile", 8, "", "powerPurifierTile", "")];
powerGamble = false;
powerGamble2 = false;
powerEmpty = false;
powerUnclog = false;
powerSpreading = false;
powerIncreasedComboTime = false;
powerIncreasedComboTime2 = false;
powerComboRefresh = false;
powerDiagonal = false;
powerOmegaPremium = false;
powerNoMoreOmega = false;
powerPurifierTile = false;
super();
}
public function getNextPowers():Array{
var _local1:Array;
var _local2:*;
var _local3:PowerEntry;
_local1 = new Array();
_local2 = 0;
while (_local2 < powerarray.length) {
_local3 = powerarray[_local2];
if (board.level >= _local3.minlevel){
if (this[_local3.variablename] == false){
if (_local3.prerequisite != ""){
if (this[_local3.prerequisite] == true){
_local1.push(_local3);
};
} else {
_local1.push(_local3);
};
};
};
_local2++;
};
return (_local1);
}
public function implEmptyBoard(){
var _local1:int;
var _local2:Piece;
var _local3:*;
_local1 = 0;
while (_local1 < board.piecelist.length) {
_local2 = board.piecelist[_local1];
_local3 = board.getRowColumnOfPiece(_local2);
if (_local3.r != -1){
if (board.isComboing(_local2) == null){
board.piecelist.splice(board.piecelist.indexOf(_local2), 1);
_local1--;
board.explodePiece(_local2);
board.pieceLayer.removeChild(_local2);
};
};
_local1++;
};
}
public function setBoard(_arg1:Board){
this.board = _arg1;
}
public function implAddTwinkle(){
var _local1:int;
var _local2:Piece;
var _local3:*;
_local1 = 0;
while (_local1 < board.piecelist.length) {
_local2 = board.piecelist[_local1];
_local3 = board.getRowColumnOfPiece(_local2);
if (_local3.r == -1){
_local2.twinkle.visible = true;
};
_local1++;
};
}
public function implUnclogBoard(){
var _local1:int;
var _local2:Piece;
var _local3:*;
_local1 = 0;
while (_local1 < board.piecelist.length) {
_local2 = board.piecelist[_local1];
_local3 = board.getRowColumnOfPiece(_local2);
if ((((((((_local3.r == 0)) || ((_local3.r == 3)))) || ((_local3.c == 0)))) || ((_local3.c == 3)))){
if (board.isComboing(_local2) == null){
board.piecelist.splice(board.piecelist.indexOf(_local2), 1);
_local1--;
board.explodePiece(_local2);
board.pieceLayer.removeChild(_local2);
};
};
_local1++;
};
}
public function invoke(_arg1:PowerEntry){
this[_arg1.variablename] = true;
if (_arg1.implementname != ""){
var _local2 = this;
_local2[_arg1.implementname]();
};
}
public function implRemoveOmega(){
var _local1:int;
var _local2:Piece;
var _local3:*;
_local1 = 0;
while (_local1 < board.piecelist.length) {
_local2 = board.piecelist[_local1];
if (_local2.symbol == "omega"){
_local3 = board.getRowColumnOfPiece(_local2);
if (_local3.r == -1){
_local2.setRandom();
} else {
if (board.isComboing(_local2) == null){
board.piecelist.splice(board.piecelist.indexOf(_local2), 1);
_local1--;
board.explodePiece(_local2);
board.pieceLayer.removeChild(_local2);
};
};
};
_local1++;
};
}
}
}//package
Section 13
//PowerEntry (PowerEntry)
package {
public class PowerEntry {
public var minlevel:int;
public var implementname:String;
public var prerequisite:String;
public var title:String;
public var variablename:String;
public function PowerEntry(_arg1, _arg2, _arg3, _arg4, _arg5){
this.title = _arg1;
this.minlevel = _arg2;
this.prerequisite = _arg3;
this.variablename = _arg4;
this.implementname = _arg5;
}
}
}//package
Section 14
//PowerServer (PowerServer)
package {
import flash.events.*;
import flash.media.*;
import flash.display.*;
public dynamic class PowerServer extends MovieClip {
public var downb:SimpleButton;
public var xdirection:int;// = -10
public var travelling:Boolean;// = false
public var upb:SimpleButton;
public var taglist:Array;
public var rotdir:int;// = 0
public var psg:PowerServerGraphic;
public var board:Board;
public var rotsofar:int;// = 60
public function PowerServer(){
travelling = false;
xdirection = -10;
rotsofar = 60;
rotdir = 0;
super();
this.y = 430;
this.x = -170;
taglist = new Array();
upb.addEventListener("click", onUp);
downb.addEventListener("click", onDown);
this.addEventListener("enterFrame", onFrame);
}
public function onClickTag(_arg1:Event){
var _local2:PowerTag;
var _local3:Sound;
trace("Click Tag");
if ((_arg1.currentTarget is PowerTag)){
_local2 = PowerTag(_arg1.currentTarget);
trace(("It was " + _local2.entry.title));
if (_local2.rotation == 0){
_local3 = new SoundSwitchClick();
_local3.play();
board.chosePower(_local2.entry);
};
};
}
public function onDown(_arg1:Event){
var _local2:Sound;
trace("Click down");
if ((((rotsofar == 60)) || ((rotsofar == -60)))){
rotsofar = 0;
rotdir = -3;
};
_local2 = new SoundSwitchClick();
_local2.play();
}
public function setBoard(_arg1:Board){
this.board = _arg1;
}
public function onFrame(_arg1:Event){
var _local2:*;
var _local3:MovieClip;
if (travelling){
this.x = (this.x + xdirection);
if ((((this.x <= -170)) || ((this.x >= 15)))){
travelling = false;
};
};
if (((!((rotsofar == 60))) && (!((rotsofar == -60))))){
_local2 = 0;
while (_local2 < taglist.length) {
_local3 = taglist[_local2];
_local3.rotation = (_local3.rotation + rotdir);
_local2++;
};
rotsofar = (rotsofar + rotdir);
};
}
public function move(_arg1:Array){
var _local2:Array;
var _local3:*;
var _local4:PowerTag;
xdirection = (xdirection * -1);
travelling = true;
trace(("PowerServer: powerlist length is " + _arg1.length));
while (taglist.length > 0) {
this.removeChild(taglist[0]);
taglist.shift();
};
if ((((xdirection > 0)) && ((_arg1.length > 0)))){
if (_arg1.length > 6){
_arg1.splice(((_arg1.length - 1) - (_arg1.length - 6)), (_arg1.length - 6));
};
_local2 = [[0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 1, 0, 1, 0, 1], [0, 1, 2, 0, 1, 2], [0, 1, 2, 3, 2, 1], [0, 1, 2, 3, 4, 2], [0, 1, 2, 3, 4, 5]];
this.removeChild(psg);
this.removeChild(upb);
this.removeChild(downb);
_local3 = 0;
while (_local3 < 6) {
_local4 = new PowerTag(_arg1[_local2[_arg1.length][_local3]]);
_local4.x = 0;
_local4.y = 0;
_local4.rotation = (60 * _local3);
taglist.push(_local4);
_local4.addEventListener("click", onClickTag);
this.addChild(_local4);
_local3++;
};
this.addChild(psg);
this.addChild(upb);
this.addChild(downb);
};
}
public function onUp(_arg1:Event){
var _local2:Sound;
trace("Click up");
if ((((rotsofar == 60)) || ((rotsofar == -60)))){
rotsofar = 0;
rotdir = 3;
};
_local2 = new SoundSwitchClick();
_local2.play();
}
}
}//package
Section 15
//PowerServerGraphic (PowerServerGraphic)
package {
import flash.display.*;
public dynamic class PowerServerGraphic extends MovieClip {
}
}//package
Section 16
//PowerTag (PowerTag)
package {
import flash.display.*;
import flash.text.*;
public dynamic class PowerTag extends MovieClip {
public var tfTitle:TextField;
public var tfMinLevel:TextField;
public var entry:PowerEntry;
public function PowerTag(_arg1:PowerEntry){
this.entry = _arg1;
this.tfTitle.text = _arg1.title.toUpperCase();
this.tfMinLevel.text = (("Level " + _arg1.minlevel) + ((_arg1.prerequisite)=="") ? "" : "*");
if (tfTitle.textWidth > 160){
tfTitle.scaleX = ((1 / (tfTitle.textWidth / 160)) - 0.1);
} else {
tfTitle.scaleX = 1;
};
tfTitle.x = 35;
this.buttonMode = true;
this.useHandCursor = true;
}
}
}//package
Section 17
//Preloader (Preloader)
package {
import flash.events.*;
import flash.display.*;
public dynamic class Preloader extends MovieClip {
public var fill:MovieClip;
public function Preloader(){
this.parent.loaderInfo.addEventListener(ProgressEvent.PROGRESS, onFrame);
}
public function onFrame(_arg1:ProgressEvent){
fill.width = ((_arg1.bytesLoaded / _arg1.bytesTotal) * 294);
if (_arg1.bytesLoaded == _arg1.bytesTotal){
Main.preloaderDone();
};
}
}
}//package
Section 18
//Presentation (Presentation)
package {
import flash.events.*;
import flash.media.*;
import flash.display.*;
public dynamic class Presentation extends MovieClip {
public var materials:PresentationMaterials;
public var timeout:int;// = 0
public var frametoshow:String;
public var clicktocontinue:MovieClip;
public var ready:Boolean;// = true
public var board:Board;
public function Presentation(_arg1:Board){
ready = true;
timeout = 0;
super();
addFrameScript(13, frame14, 30, frame31);
gotoAndStop("start");
board = _arg1;
this.visible = false;
materials.visible = false;
}
private function countdown(_arg1:Event){
timeout--;
if (timeout <= 0){
trueStartPresentation();
removeEventListener("enterFrame", countdown);
};
}
public function startMessage(){
var _local1:Boolean;
var _local2:Array;
var _local3:uint;
var _local4:FrameLabel;
_local1 = false;
_local2 = materials.currentLabels;
_local3 = 0;
while (_local3 < _local2.length) {
_local4 = _local2[_local3];
if (_local4.name == frametoshow){
_local1 = true;
break;
};
_local3++;
};
materials.visible = true;
if (_local1){
materials.gotoAndPlay(frametoshow);
} else {
materials.gotoAndPlay("intro");
};
materials.fadeIn();
stop();
}
function frame14(){
startMessage();
}
public function finished(){
board.messageQueue.shift();
board.pauseGame(false, true);
ready = true;
stop();
this.visible = false;
}
public function done(){
clicktocontinue.visible = true;
addEventListener("click", onClick);
}
function frame31(){
finished();
}
private function trueStartPresentation(){
var _local1:Sound;
this.visible = true;
ready = false;
gotoAndPlay("start");
clicktocontinue.visible = false;
_local1 = new SoundCurtainSlide();
_local1.play();
}
public function startPresentation(_arg1:String, _arg2:int){
timeout = _arg2;
frametoshow = _arg1;
materials.visible = false;
addEventListener("enterFrame", countdown);
}
public function onClick(_arg1:Event){
var _local2:Sound;
removeEventListener("click", onClick);
materials.visible = false;
clicktocontinue.visible = false;
if (board.messageQueue.length <= 1){
play();
} else {
board.messageQueue.shift();
frametoshow = board.messageQueue[0][0];
startMessage();
};
_local2 = new SoundSwitchClick();
_local2.play();
}
}
}//package
Section 19
//PresentationMaterials (PresentationMaterials)
package {
import flash.events.*;
import flash.display.*;
import flash.text.*;
public dynamic class PresentationMaterials extends MovieClip {
public function PresentationMaterials(){
addFrameScript(1, frame2, 2, frame3, 3, frame4, 4, frame5, 5, frame6, 6, frame7, 7, frame8, 8, frame9, 9, frame10, 10, frame11, 11, frame12, 12, frame13, 13, frame14, 14, frame15);
}
function frame10(){
stop();
}
function frame14(){
stop();
}
function frame12(){
stop();
}
function frame3(){
stop();
}
function frame6(){
stop();
}
function frame7(){
stop();
}
function frame8(){
stop();
}
function frame13(){
stop();
}
function frame4(){
stop();
}
function frame5(){
stop();
}
function frame9(){
stop();
}
function frame2(){
stop();
}
function frame15(){
stop();
}
public function done(){
stop();
Presentation(this.parent).done();
}
function frame11(){
stop();
}
public function fadeIn(){
this.alpha = 0;
addEventListener("enterFrame", onFrame);
}
public function onFrame(_arg1:Event){
this.alpha = (this.alpha + 0.08);
if (this.alpha >= 1){
done();
removeEventListener("enterFrame", onFrame);
};
}
}
}//package
Section 20
//ScoreAppear (ScoreAppear)
package {
import flash.events.*;
import flash.display.*;
import flash.text.*;
public dynamic class ScoreAppear extends MovieClip {
public var timeAlive:int;// = 0
public var tfScore:TextField;
public var board:Board;
public function ScoreAppear(_arg1:int, _arg2, _arg3:Number, _arg4:Board){
timeAlive = 0;
super();
trace(((("tfScore is " + tfScore) + " and its starting text is ") + tfScore.text));
tfScore.text = (("" + _arg1) + "");
tfScore.text = commaSet(tfScore.text);
this.x = _arg2;
this.y = _arg3;
this.board = _arg4;
addEventListener("enterFrame", onFrame);
}
public function commaSet(_arg1:String){
var _local2:String;
var _local3:int;
var _local4:*;
_local2 = "";
_local3 = 0;
_local4 = (_arg1.length - 1);
while (_local4 >= 0) {
_local2 = (_arg1.charAt(_local4) + _local2);
_local3++;
if (_local3 == 3){
if (_local4 != 0){
_local2 = ("," + _local2);
};
_local3 = 0;
};
_local4--;
};
return (_local2);
}
public function onFrame(_arg1:Event){
this.y--;
timeAlive++;
if (timeAlive > 20){
this.alpha = (this.alpha - 0.05);
};
if (this.alpha <= 0){
removeEventListener("enterFrame", onFrame);
board.scoreLayer.removeChild(this);
};
}
}
}//package
Section 21
//ScoreDigit (ScoreDigit)
package {
import flash.display.*;
import flash.text.*;
public dynamic class ScoreDigit extends MovieClip {
public var tfDigit:TextField;
}
}//package
Section 22
//ScoreField (ScoreField)
package {
import flash.events.*;
import flash.display.*;
import flash.text.*;
public class ScoreField extends MovieClip {
public var ONETRILLION:Number;// = 1000000000000
public var total:Number;// = 0
public var trillions:Number;// = 0
public var decaytime:int;// = 0
public var digits:Array;
public var decaying:Boolean;// = false
public function ScoreField(){
total = 0;
trillions = 0;
ONETRILLION = 1000000000000;
decaying = false;
decaytime = 0;
super();
digits = new Array();
makeDigitsForScore();
}
public function onDecayFrame(_arg1:Event){
var _local2:*;
_local2 = 0;
while (_local2 < digits.length) {
digits[_local2].x = (digits[_local2].x + (digits[_local2].drift * digits[_local2].factor));
digits[_local2].y = (digits[_local2].y + (digits[_local2].fall * digits[_local2].factor));
digits[_local2].rotation = (digits[_local2].rotation + (digits[_local2].tiltdrift * digits[_local2].factor));
digits[_local2].factor = (digits[_local2].factor + 0.03);
if (digits[_local2].factor > 3){
digits[_local2].factor = 3;
};
_local2++;
};
decaytime++;
if (decaytime > 250){
this.alpha = (this.alpha - 0.003);
};
if (this.alpha <= 0){
removeEventListener("enterFrame", onDecayFrame);
};
}
public function addScore(_arg1:Number){
if (decaying){
return;
};
total = (total + _arg1);
adjustNumbers();
makeDigitsForScore();
}
public function startDecay(){
var _local1:*;
decaying = true;
_local1 = 0;
while (_local1 < digits.length) {
digits[_local1].drift = ((Math.random() - 0.5) / 3);
digits[_local1].tiltdrift = ((Math.random() - 0.5) / 3);
digits[_local1].fall = ((Math.random() / 4) + 0.2);
digits[_local1].factor = 0.1;
_local1++;
};
addEventListener("enterFrame", onDecayFrame);
}
public function commaSet(_arg1:String){
var _local2:String;
var _local3:int;
var _local4:*;
_local2 = "";
_local3 = 0;
_local4 = (_arg1.length - 1);
while (_local4 >= 0) {
_local2 = (_arg1.charAt(_local4) + _local2);
_local3++;
if (_local3 == 3){
if (_local4 != 0){
_local2 = ("," + _local2);
};
_local3 = 0;
};
_local4--;
};
return (_local2);
}
public function adjustNumbers(){
while (total > ONETRILLION) {
trillions++;
total = (total - ONETRILLION);
};
}
public function multiplyScore(_arg1:Number){
if (decaying){
return;
};
total = (total * _arg1);
adjustNumbers();
makeDigitsForScore();
}
public function makeDigitsForScore(){
var _local1:String;
var _local2:int;
var _local3:*;
var _local4:ScoreDigit;
while (digits.length > 0) {
removeChild(digits[0]);
digits.shift();
};
_local1 = "";
_local1 = (((trillions)>0) ? String(trillions) : "" + String(total));
_local1 = commaSet(_local1);
_local2 = 0;
_local3 = 0;
while (_local3 < _local1.length) {
_local4 = new ScoreDigit();
_local4.tfDigit.text = _local1.charAt(_local3);
_local4.x = _local2;
_local4.y = 0;
_local2 = (_local2 + Math.ceil(_local4.tfDigit.textWidth));
addChild(_local4);
digits.push(_local4);
_local3++;
};
this.x = (((550 / 2) - (_local2 / 2)) - 5);
}
}
}//package
Section 23
//SoundChuteThrow (SoundChuteThrow)
package {
import flash.media.*;
public dynamic class SoundChuteThrow extends Sound {
}
}//package
Section 24
//SoundComboLoop (SoundComboLoop)
package {
import flash.media.*;
public dynamic class SoundComboLoop extends Sound {
}
}//package
Section 25
//SoundCurtainSlide (SoundCurtainSlide)
package {
import flash.media.*;
public dynamic class SoundCurtainSlide extends Sound {
}
}//package
Section 26
//SoundLetsPlay (SoundLetsPlay)
package {
import flash.media.*;
public dynamic class SoundLetsPlay extends Sound {
}
}//package
Section 27
//SoundNotAllowed (SoundNotAllowed)
package {
import flash.media.*;
public dynamic class SoundNotAllowed extends Sound {
}
}//package
Section 28
//SoundPiecesUpInSmoke (SoundPiecesUpInSmoke)
package {
import flash.media.*;
public dynamic class SoundPiecesUpInSmoke extends Sound {
}
}//package
Section 29
//SoundPieceTap (SoundPieceTap)
package {
import flash.media.*;
public dynamic class SoundPieceTap extends Sound {
}
}//package
Section 30
//SoundPowerSelect (SoundPowerSelect)
package {
import flash.media.*;
public dynamic class SoundPowerSelect extends Sound {
}
}//package
Section 31
//SoundSwitchClick (SoundSwitchClick)
package {
import flash.media.*;
public dynamic class SoundSwitchClick extends Sound {
}
}//package
Section 32
//SoundTimeIsShort (SoundTimeIsShort)
package {
import flash.media.*;
public dynamic class SoundTimeIsShort extends Sound {
}
}//package
Section 33
//Tile (Tile)
package {
import flash.display.*;
public dynamic class Tile extends MovieClip {
public var square:MovieClip;
public var state:String;
public var braced:MovieClip;
public var bracel;
public var bracer;
public var purepulse:MovieClip;
public var braceu;
public var ispurified:Boolean;// = false
public static var WHITENORMAL:String = "white";
public static var BLACKNORMAL:String = "black";
public function Tile(){
ispurified = false;
super();
purepulse.visible = false;
ispurified = false;
}
public function setFrame(_arg1:String){
square.gotoAndStop(_arg1);
}
public function purify(){
ispurified = true;
purepulse.visible = true;
}
}
}//package
Section 34
//XPCountdown (XPCountdown)
package {
import flash.events.*;
import flash.display.*;
import flash.text.*;
public dynamic class XPCountdown extends MovieClip {
public var timealive:int;// = 0
public var tfCount:TextField;
public function XPCountdown(){
timealive = 0;
super();
tfCount.mouseEnabled = false;
this.alpha = 0;
}
public function onFadeFrame(_arg1:Event){
timealive++;
if (timealive < 10){
this.alpha = (this.alpha + 0.08);
if (this.alpha >= 1){
this.alpha = 1;
};
};
if (timealive > 12){
this.alpha = (this.alpha - 0.04);
if (this.alpha <= 0){
removeEventListener("enterFrame", onFadeFrame);
};
};
}
public function flash(_arg1:int){
tfCount.text = String(_arg1);
this.alpha = 0.4;
timealive = 0;
addEventListener("enterFrame", onFadeFrame);
}
}
}//package
Section 35
//XPMeter (XPMeter)
package {
import flash.display.*;
import flash.text.*;
public dynamic class XPMeter extends MovieClip {
public var tfLevel:TextField;
public var tfTimeOut:TextField;
public var markers:Array;
public function XPMeter(){
markers = new Array();
}
public function update(_arg1, _arg2){
var _local3:*;
var _local4:*;
var _local5:Sprite;
var _local6:Sprite;
tfLevel.text = ("LEVEL " + _arg2);
if (_arg2 == 10){
tfLevel.text = "FINAL";
};
while (markers.length > 0) {
_local5 = markers.pop();
removeChild(_local5);
};
_local4 = tfLevel.x;
_local3 = 0;
while (_local3 < _arg1) {
if (((_local3 + 1) % 5) != 0){
_local6 = new LevelMark();
} else {
_local6 = new DarkLevelMark();
};
_local6.x = (((0 - tfLevel.textWidth) - 10) - ((_local6.width - 1) * _local3));
_local6.y = 6;
addChild(_local6);
markers.push(_local6);
_local4 = (_local4 - (_local6.width - 1));
_local3++;
};
tfTimeOut.x = ((_local4 - 5) - tfTimeOut.textWidth);
}
public function timeUpdate(_arg1){
var _local2:String;
_local2 = ((("" + Math.floor((_arg1 / 60))) + ":") + (((_arg1 % 60))<10) ? ("0" + (_arg1 % 60)) : (_arg1 % 60));
tfTimeOut.text = _local2;
}
}
}//package