Section 1
//DDSPmc_9 (QBsponsor_fla.DDSPmc_9)
package QBsponsor_fla {
import flash.events.*;
import flash.media.*;
import flash.display.*;
import flash.net.*;
import flash.text.*;
import flash.filters.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.geom.*;
import flash.printing.*;
import flash.system.*;
import flash.ui.*;
import flash.utils.*;
import flash.xml.*;
public dynamic class DDSPmc_9 extends MovieClip {
public var loaded:Boolean;
public var slot4:SimpleButton;
public var songsf:SharedObject;
public var loadb:SimpleButton;
public var loopb:SimpleButton;
public var origy:Number;
public var indi:MovieClip;
public var loopy:Boolean;
public var maxmin:SimpleButton;
public var indidrag:Boolean;
public var stopb:SimpleButton;
public var stopp:Boolean;
public var urlReq:URLRequest;
public var volumebar:MovieClip;
public var songidbox:TextField;
public var randb:SimpleButton;
public var onehund:Boolean;
public var leng:Number;
public var fb1:TextField;
public var fb2:TextField;
public var fb3:TextField;
public var fb4:TextField;
public var fb5:TextField;
public var yspot:Number;
public var faveb:SimpleButton;
public var sound:Sound;
public var pauseb:SimpleButton;
public var favesave:Boolean;
public var pausee:Boolean;
public var drag:Boolean;
public var cursong:Number;
public var sndChannel:SoundChannel;
public var filter:GlowFilter;
public var slist:Array;
public var ltext:TextField;
public var playb:SimpleButton;
public var chanpos:Number;
public var vindi:MovieClip;
public var lengbar:MovieClip;
public var slot1:SimpleButton;
public var slot2:SimpleButton;
public var slot3:SimpleButton;
public var dalink:SimpleButton;
public var slot5:SimpleButton;
public function DDSPmc_9(){
addFrameScript(0, frame1);
}
public function stopdrag(_arg1:MouseEvent){
drag = false;
}
function frame1(){
slist = new Array();
origy = y;
yspot = origy;
loopy = true;
loopb.alpha = 0.9;
leng = lengbar.width;
loaded = false;
onehund = false;
songsf = SharedObject.getLocal("DDSP");
stopp = false;
pausee = false;
indidrag = false;
songload();
if (songsf.data.saved == 1){
if (((!((songsf.data.fb1 == undefined))) && (!((songsf.data.fb1 == ""))))){
fb1.text = songsf.data.fb1;
} else {
fb1.text = "None";
};
if (((!((songsf.data.fb2 == undefined))) && (!((songsf.data.fb2 == ""))))){
fb2.text = songsf.data.fb2;
} else {
fb2.text = "None";
};
if (((!((songsf.data.fb3 == undefined))) && (!((songsf.data.fb3 == ""))))){
fb3.text = songsf.data.fb3;
} else {
fb3.text = "None";
};
if (((((!((songsf.data.fb4 == undefined))) && (!((songsf.data.fb4 == ""))))) && (!((songsf.data.fb4 == "None"))))){
fb4.text = songsf.data.fb4;
} else {
fb4.text = "30000";
};
if (((((!((songsf.data.fb5 == undefined))) && (!((songsf.data.fb5 == ""))))) && (!((songsf.data.fb5 == "None"))))){
fb5.text = songsf.data.fb5;
} else {
fb5.text = "60039";
};
} else {
fb1.text = "None";
fb2.text = "None";
fb3.text = "None";
fb4.text = "30000";
fb5.text = "60039";
};
favesave = false;
songidbox.text = cursong.toString();
slot1.addEventListener(MouseEvent.CLICK, ddspclick);
slot2.addEventListener(MouseEvent.CLICK, ddspclick);
slot3.addEventListener(MouseEvent.CLICK, ddspclick);
slot4.addEventListener(MouseEvent.CLICK, ddspclick);
slot5.addEventListener(MouseEvent.CLICK, ddspclick);
playb.addEventListener(MouseEvent.CLICK, ddspclick);
stopb.addEventListener(MouseEvent.CLICK, ddspclick);
loadb.addEventListener(MouseEvent.CLICK, ddspclick);
randb.addEventListener(MouseEvent.CLICK, ddspclick);
faveb.addEventListener(MouseEvent.CLICK, ddspclick);
pauseb.addEventListener(MouseEvent.CLICK, ddspclick);
loopb.addEventListener(MouseEvent.CLICK, ddspclick);
dalink.addEventListener(MouseEvent.CLICK, ddspclick);
maxmin.addEventListener(MouseEvent.CLICK, ddspclick);
indi.addEventListener(MouseEvent.MOUSE_DOWN, ddspclick);
addEventListener(MouseEvent.MOUSE_UP, indirel);
drag = false;
vindi.addEventListener(MouseEvent.MOUSE_DOWN, dragness);
addEventListener(MouseEvent.MOUSE_UP, stopdrag);
addEventListener(Event.ENTER_FRAME, dragoef);
}
public function finish(_arg1){
if (loopy){
sndChannel.removeEventListener(Event.SOUND_COMPLETE, finish);
sndChannel.stop();
sndChannel = sound.play();
sndChannel.addEventListener(Event.SOUND_COMPLETE, finish);
} else {
cursong = Math.round((Math.random() * 100000));
songload();
};
}
public function ddspclick(_arg1:MouseEvent){
var nglink:*;
var event = _arg1;
var _local3 = event.target;
with (_local3) {
if (name == "playb"){
if (loaded){
if (stopp){
sndChannel = sound.play();
sndChannel.addEventListener(Event.SOUND_COMPLETE, finish);
stopp = false;
};
if (pausee){
sndChannel = sound.play(chanpos);
sndChannel.addEventListener(Event.SOUND_COMPLETE, finish);
pausee = false;
};
};
};
if (name == "stopb"){
if (((loaded) && (!(pausee)))){
sndChannel.removeEventListener(Event.SOUND_COMPLETE, finish);
sndChannel.stop();
pausee = false;
stopp = true;
};
};
if (name == "pauseb"){
if (((loaded) && (!(stopp)))){
chanpos = sndChannel.position;
sndChannel.removeEventListener(Event.SOUND_COMPLETE, finish);
sndChannel.stop();
stopp = false;
pausee = true;
};
};
if (name == "loadb"){
cursong = songidbox.text;
songload();
};
if (name == "randb"){
cursong = Math.round((Math.random() * 130000));
songload();
};
if (name == "loopb"){
if (loopy == true){
loopy = false;
alpha = 0.1;
} else {
alpha = 0.9;
loopy = true;
};
};
if (name == "faveb"){
if (favesave == false){
favesave = true;
filter = new GlowFilter(0xFFFFFF, 0.8, 10, 10, 10);
} else {
favesave = false;
filter = new GlowFilter(0xFFFFFF, 0, 0, 0, 0);
};
faveb.filters = [filter];
slot1.filters = [filter];
slot2.filters = [filter];
slot3.filters = [filter];
slot4.filters = [filter];
slot5.filters = [filter];
};
if ((((((((((name == "slot1")) || ((name == "slot2")))) || ((name == "slot3")))) || ((name == "slot4")))) || ((name == "slot5")))){
if (favesave){
songsf.data.saved = 1;
if (name == "slot1"){
fb1.text = cursong.toString();
};
if (name == "slot2"){
fb2.text = cursong.toString();
};
if (name == "slot3"){
fb3.text = cursong.toString();
};
if (name == "slot4"){
fb4.text = cursong.toString();
};
if (name == "slot5"){
fb5.text = cursong.toString();
};
filter = new GlowFilter(0xFFFFFF, 0, 0, 0, 0);
faveb.filters = [filter];
slot1.filters = [filter];
slot2.filters = [filter];
slot3.filters = [filter];
slot4.filters = [filter];
slot5.filters = [filter];
songsf.data.fb1 = fb1.text;
songsf.data.fb2 = fb2.text;
songsf.data.fb3 = fb3.text;
songsf.data.fb4 = fb4.text;
songsf.data.fb5 = fb5.text;
songsf.flush();
favesave = false;
} else {
if ((((((name == "slot1")) && (!((fb1.text == "None"))))) && (!((cursong == fb1.text))))){
cursong = fb1.text;
songload();
};
if ((((((name == "slot2")) && (!((fb2.text == "None"))))) && (!((cursong == fb2.text))))){
cursong = fb2.text;
songload();
};
if ((((((name == "slot3")) && (!((fb3.text == "None"))))) && (!((cursong == fb3.text))))){
cursong = fb3.text;
songload();
};
if ((((((name == "slot4")) && (!((fb4.text == "None"))))) && (!((cursong == fb4.text))))){
cursong = fb4.text;
songload();
};
if ((((((name == "slot5")) && (!((fb5.text == "None"))))) && (!((cursong == fb5.text))))){
cursong = fb5.text;
songload();
};
};
};
if (name == "dalink"){
nglink = new URLRequest(("http://www.newgrounds.com/audio/listen/" + cursong));
navigateToURL(nglink, "_blank");
};
if (name == "indi"){
sndChannel.removeEventListener(Event.SOUND_COMPLETE, finish);
sndChannel.stop();
indidrag = true;
};
};
if (event.target.name == "maxmin"){
if (yspot == origy){
yspot = (origy - 290);
} else {
yspot = origy;
};
};
songidbox.text = cursong.toString();
}
public function removeness(){
if (!onehund){
sound.close();
};
sndChannel.stop();
removeEventListener(Event.ENTER_FRAME, ddspoef);
vindi.removeEventListener(MouseEvent.MOUSE_DOWN, dragness);
removeEventListener(MouseEvent.MOUSE_UP, stopdrag);
removeEventListener(Event.ENTER_FRAME, dragoef);
slot1.removeEventListener(MouseEvent.CLICK, ddspclick);
slot2.removeEventListener(MouseEvent.CLICK, ddspclick);
slot3.removeEventListener(MouseEvent.CLICK, ddspclick);
slot4.removeEventListener(MouseEvent.CLICK, ddspclick);
slot5.removeEventListener(MouseEvent.CLICK, ddspclick);
playb.removeEventListener(MouseEvent.CLICK, ddspclick);
stopb.removeEventListener(MouseEvent.CLICK, ddspclick);
loadb.removeEventListener(MouseEvent.CLICK, ddspclick);
randb.removeEventListener(MouseEvent.CLICK, ddspclick);
faveb.removeEventListener(MouseEvent.CLICK, ddspclick);
pauseb.removeEventListener(MouseEvent.CLICK, ddspclick);
loopb.removeEventListener(MouseEvent.CLICK, ddspclick);
dalink.removeEventListener(MouseEvent.CLICK, ddspclick);
maxmin.removeEventListener(MouseEvent.CLICK, ddspclick);
indi.removeEventListener(MouseEvent.MOUSE_DOWN, ddspclick);
removeEventListener(MouseEvent.MOUSE_UP, indirel);
}
public function ddspoef(_arg1:Event){
var _local2:int;
var _local3:SoundTransform;
if (loaded){
_local2 = Math.ceil((sound.length / (sound.bytesLoaded / sound.bytesTotal)));
if (!indidrag){
if (!stopp){
indi.x = (lengbar.x + ((leng * sndChannel.position) / _local2));
} else {
indi.x = lengbar.x;
};
} else {
if ((((mouseX > lengbar.x)) && ((mouseX < (lengbar.x + leng))))){
indi.x = mouseX;
} else {
sndChannel.stop();
sndChannel = sound.play(((Math.ceil((sound.length / (sound.bytesLoaded / sound.bytesTotal))) * (indi.x - lengbar.x)) / leng));
indidrag = false;
};
};
_local3 = new SoundTransform();
_local3.volume = ((volumebar.y - vindi.y) / volumebar.height);
sndChannel.soundTransform = _local3;
};
}
public function songload(){
var playin:Boolean;
var loading:Function;
loading = function (_arg1:ProgressEvent){
var _local2:Number;
_local2 = Math.round((100 * (_arg1.bytesLoaded / _arg1.bytesTotal)));
lengbar.width = ((_local2 / 100) * leng);
if ((((_local2 >= 1)) && (!(playin)))){
loaded = true;
sndChannel = sound.play();
sndChannel.addEventListener(Event.SOUND_COMPLETE, finish);
playin = true;
addEventListener(Event.ENTER_FRAME, ddspoef);
slist.push(cursong);
};
if (_local2 >= 100){
onehund = true;
} else {
onehund = false;
};
ltext.text = (_local2.toString() + "%");
if (ltext.text == "Infinity%"){
sound.close();
cursong = Math.round((Math.random() * 100000));
songidbox.text = cursong.toString();
songload();
};
};
songidbox.text = cursong.toString();
if (loaded){
sndChannel.stop();
sndChannel.removeEventListener(Event.SOUND_COMPLETE, finish);
removeEventListener(Event.ENTER_FRAME, ddspoef);
if (!onehund){
sound.close();
};
};
stopp = false;
pausee = false;
playin = false;
urlReq = new URLRequest(("http://newgrounds.com/audio/download.php?which=single&id=" + cursong));
sound = new Sound(urlReq);
sound.addEventListener(ProgressEvent.PROGRESS, loading);
}
public function dragness(_arg1:MouseEvent){
drag = true;
}
public function dragoef(_arg1:Event){
if (drag){
vindi.y = mouseY;
};
if (vindi.y < (volumebar.y - volumebar.height)){
vindi.y = (volumebar.y - volumebar.height);
drag = false;
};
if (vindi.y > volumebar.y){
vindi.y = volumebar.y;
drag = false;
};
y = (y + ((yspot - y) / 10));
}
public function indirel(_arg1:MouseEvent){
if (indidrag){
stopp = false;
sndChannel = sound.play(((Math.round((sound.length / (sound.bytesLoaded / sound.bytesTotal))) * (indi.x - lengbar.x)) / leng));
sndChannel.addEventListener(Event.SOUND_COMPLETE, finish);
};
drag = false;
indidrag = false;
}
}
}//package QBsponsor_fla
Section 2
//MainTimeline (QBsponsor_fla.MainTimeline)
package QBsponsor_fla {
import flash.events.*;
import flash.media.*;
import flash.display.*;
import flash.net.*;
import flash.text.*;
import flash.filters.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.geom.*;
import flash.printing.*;
import flash.system.*;
import flash.ui.*;
import flash.utils.*;
import flash.xml.*;
public dynamic class MainTimeline extends MovieClip {
public const stagewid:Number;
public const stagehei:Number;
public var shifttimer:Number;
public var mishcolour:Number;
public var b1:SimpleButton;
public var b2:SimpleButton;
public var b4:SimpleButton;
public var b5:SimpleButton;
public var b3:SimpleButton;
public var b6:SimpleButton;
public var skiptf:TextFormat;
public var ohcrap:Boolean;
public var colamt:Number;
public var sndpos:Number;
public var timeleft:TextField;
public var titleformat:TextFormat;
public var timetrial:Boolean;
public var whabam:Number;
public var titlebox:TextField;
public var addness:Boolean;
public var missiontextbox:TextField;
public var ds:SoundChannel;
public var yspot1:Number;
public var yspot2:Number;
public var maxc1:Number;
public var defsong:Number;
public var score:Number;
public var swi:MovieClip;
public var maxc2:Number;
public var sectime:Number;
public var offset:Number;
public var raisecount:Number;
public var scoretext:String;
public var freezey:Boolean;
public var skipb:MovieClip;
public var woot:Number;
public var structions:Boolean;
public var skipt:TextField;
public var origsong:Boolean;
public var textf:TextFormat;
public var tttimer:Number;
public var maxcombobox:TextField;
public var curdown:Boolean;
public var tfilter:GlowFilter;
public var ags:MovieClip;
public var menusound:Sound;
public var blockermc:MovieClip;
public var donut:MovieClip;
public var daalpha:Number;
public var dsound:Sound;
public var missionmode:Boolean;
public var blockermc2:MovieClip;
public var classicmode:Boolean;
public var yorig2:Number;
public var yorig1:Number;
public var grid:Array;
public var gtimer:Number;
public var dformat:TextFormat;
public var bot1:MovieClip;
public var hselect:Boolean;
public var playbutton:MovieClip;
public var starthei:Array;
public var loadbar:MovieClip;
public var namebox:TextField;
public var mishcomb:Number;
public var top1:MovieClip;
public var combobox:TextField;
public var chaining:Boolean;
public var level:Number;
public var tiles:Array;
public var dtext:TextField;
public var mb:SimpleButton;
public var gwea:MovieClip;
public var covermc:MovieClip;
public var ptext:TextField;
public var mishcolumn:Number;
public var crazycombo:Boolean;
public var combo:Number;
public var cover:MovieClip;
public var daURL:URLRequest;
public var gtime:Number;
public var mission:Number;
public var levelbox:TextField;
public var wid:Number;
public var levelinc:Number;
public var timebox:TextField;
public var alphcount:Number;
public var shiftedh:Array;
public var menusc:SoundChannel;
public var raisemax:Number;
public var scorebox:TextField;
public var shiftedw:Array;
public var gpause:Boolean;
public function MainTimeline(){
stagewid = stage.stageWidth;
stagehei = stage.stageHeight;
super();
addFrameScript(0, frame1, 1, frame2, 2, frame3, 3, frame4, 4, frame5, 5, frame6, 6, frame7, 7, frame8);
}
public function gridify(){
var _local1:Number;
var _local2:Number;
var _local3:MovieClip;
_local1 = 0;
while (_local1 < 6) {
_local2 = 0;
while (_local2 < 13) {
if (tiles[((_local1 * 13) + _local2)] == undefined){
_local3 = new tile();
_local3.gotoAndStop(1);
_local3.datile.tilemc.gotoAndStop((grid[_local2][_local1] + 1));
_local3.x = (_local1 * wid);
_local3.y = (_local2 * wid);
_local3.origy = _local3.y;
_local3.alpha = 0.5;
_local3.width = (_local3.height = wid);
addChild(_local3);
tiles.push(_local3);
} else {
tiles[((_local1 * 13) + _local2)].gotoAndStop(1);
tiles[((_local1 * 13) + _local2)].datile.tilemc.gotoAndStop((grid[_local2][_local1] + 1));
tiles[((_local1 * 13) + _local2)].inplay = true;
};
_local2++;
};
_local1++;
};
}
public function inoef(_arg1:Event){
var _local2:uint;
_local2 = (100 * (ds.position / dsound.length));
if (_local2 > 38){
stage.addChildAt(covermc, 1);
covermc.alpha = (covermc.alpha + 0.05);
if (covermc.alpha >= 0.95){
donut.removeEventListener(MouseEvent.CLICK, donutclick);
nextFrame();
ds.stop();
donut.parent.removeChild(donut);
dtext.parent.removeChild(dtext);
covermc.parent.removeChild(covermc);
skipb.removeChild(skipt);
skipb.parent.removeChild(skipb);
skipb.removeEventListener(MouseEvent.CLICK, skipbutton);
stage.removeEventListener(Event.ENTER_FRAME, inoef);
};
};
donut.rotation = (donut.rotation + donut.xSpeed);
donut.x = (donut.x + donut.xSpeed);
donut.y = (donut.y + donut.ySpeed);
donut.xSpeed = (donut.xSpeed + ((donut.xTarget - donut.x) / donut.Speed));
donut.ySpeed = (donut.ySpeed + ((donut.yTarget - donut.y) / donut.Speed));
donut.xSpeed = (donut.xSpeed / donut.Stop);
donut.ySpeed = (donut.ySpeed / donut.Stop);
}
public function newmission(){
var _local1:Number;
var _local2:Number;
var _local3:Array;
var _local4:Array;
var _local5:Number;
var _local6:Number;
_local1 = Math.round((Math.random() * 5));
_local2 = (Math.round((Math.random() * 4)) + 2);
if (_local1 == 2){
_local5 = (Math.round((Math.random() * 3)) + 3);
_local6 = Math.round((Math.random() * 4));
} else {
_local5 = (4 + Math.round((Math.random() * 2)));
raisemax = _local5;
};
_local3 = new Array("Green", "Blue", "Red", "Orange", "Purple");
mishcomb = (Math.round((Math.random() * (level / 6))) + 2);
mishcolumn = Math.round((Math.random() * 5));
_local4 = new Array("Remove two different colors at the same time", (("Raise the grid " + _local2) + " blocks"), (((("Remove " + _local5) + " ") + _local3[_local6]) + " blocks in one move"), (("Remove " + _local5) + " blocks in one move"), (("Get a " + mishcomb) + " combo"), ("Clear column " + (mishcolumn + 1)));
missiontextbox.text = _local4[_local1].toString();
mission = _local1;
if (mission == 2){
mishcolour = (_local6 + 1);
};
if ((((mission == 2)) || ((mission == 3)))){
colamt = _local5;
};
if (mission == 1){
raisecount = 0;
};
}
public function submit(){
var _local1:URLRequest;
var _local2:URLVariables;
var _local3:String;
var _local4:URLLoader;
var _local5:Number;
_local1 = new URLRequest("http://rankz.armorbot.com/submit/as3_v0.php");
_local1.method = URLRequestMethod.POST;
_local2 = new URLVariables();
if (classicmode){
_local2.flashkey = "cEJpTkVRVHk=";
_local2.SU0249 = "MjUxM2olZSVhJW4lcw==";
};
if (crazycombo){
_local2.flashkey = "eExZQXdTcXI=";
_local2.SU0249 = "MjUxNGolZSVhJW4lcw==";
};
if (missionmode){
_local2.flashkey = "ZUNVU25TWk8=";
_local2.SU0249 = "MjUxNmolZSVhJW4lcw==";
};
if (timetrial){
_local2.flashkey = "dmdOVXRFV20=";
_local2.SU0249 = "MjUxNWolZSVhJW4lcw==";
};
_local2.bmFtZTE = namebox.text;
if (missionmode){
_local5 = ((gtime * 60) + sectime);
} else {
_local5 = score;
};
_local3 = (_local5 + "Z");
_local2.c2NvcmUx = _local3.split("0").join("U");
_local2.c2NvcmUx = _local2.c2NvcmUx.split("").join("A");
_local2.c2NvcmUx = _local2.c2NvcmUx.split("AU").join("Y");
_local2.c2NvcmUx = _local2.c2NvcmUx.split("A1").join("B");
_local2.c2NvcmUx = _local2.c2NvcmUx.split(".").join("N");
if (crazycombo){
_local2.c2NvcmUy = maxc2;
} else {
_local2.c2NvcmUy = maxc1;
};
_local1.data = _local2;
_local4 = new URLLoader();
_local4.dataFormat = URLLoaderDataFormat.TEXT;
_local4.load(_local1);
}
public function kdown2(_arg1:KeyboardEvent){
if (!gpause){
if (_arg1.keyCode == 37){
if (swi.w > 0){
swi.w = (swi.w - 1);
};
};
if (_arg1.keyCode == 38){
if (swi.h > 0){
swi.h = (swi.h - 1);
};
};
if (_arg1.keyCode == 39){
if (swi.w < 4){
swi.w = (swi.w + 1);
};
};
if (_arg1.keyCode == 40){
if (swi.h < 11){
swi.h = (swi.h + 1);
};
};
if (_arg1.keyCode == 32){
if (offset >= 50){
gridshift();
};
tileswap();
};
if (_arg1.keyCode == 90){
if (((!(freezey)) && (!(ohcrap)))){
gridshift();
gridshift();
};
};
if (((!(curdown)) && ((_arg1.keyCode == 80)))){
gamepause2();
};
} else {
if (_arg1.keyCode == 81){
gameover2();
};
if (((((!(ohcrap)) && (!(curdown)))) && ((_arg1.keyCode == 80)))){
ungamepause2();
};
};
curdown = true;
}
public function kup(_arg1:KeyboardEvent){
curdown = false;
_arg1.keyCode = 0;
}
function frame5(){
mb.addEventListener(MouseEvent.CLICK, mclick);
}
function frame1(){
NewgroundsAPI.linkAPI(this);
NewgroundsAPI.connectMovie(479);
stop();
titlebox = new TextField();
titleformat = new TextFormat();
titlebox.x = ((stage.stageWidth / 2) - 125);
titlebox.y = (((stage.stageHeight / 2) + 125) - (titlebox.height / 50));
titlebox.width = 250;
titlebox.embedFonts = true;
titleformat.font = "BankGothic Md BT";
titleformat.color = 0xFFFFFF;
titleformat.size = 20;
titleformat.align = "center";
titlebox.selectable = false;
titlebox.defaultTextFormat = titleformat;
titlebox.text = "Quadrilateral Battle";
addChild(titlebox);
textf = new TextFormat();
textf.font = "BankGothic Md BT";
textf.size = 20;
textf.color = 0xCCCCCC;
loadbar = new MovieClip();
loadbar.stagewid = 240;
loadbar.x = (-((loadbar.stagewid / 2)) + (stage.stageWidth / 2));
loadbar.y = (((stage.stageHeight / 2) + 125) + 20);
addChild(loadbar);
playbutton = new MovieClip();
var _local2 = playbutton;
with (_local2) {
graphics.lineStyle(2, 0xFFFFFF, 0);
graphics.beginFill(0, 0);
graphics.drawRect(0, 0, 50, 20);
graphics.endFill();
};
ptext = new TextField();
ptext.defaultTextFormat = textf;
ptext.text = "Play";
ptext.height = 27.6;
ptext.width = 55;
ptext.selectable = false;
ptext.x = 0;
ptext.y = -3;
loaderInfo.addEventListener(ProgressEvent.PROGRESS, PL_LOADING);
}
function frame7(){
stop();
sndpos = 0;
maxc1 = 0;
maxc2 = 0;
ohcrap = false;
wid = 50;
score = 0;
level = 1;
grid = new Array([0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]);
starthei = new Array([(Math.ceil((Math.random() * 3)) + 4)], [(Math.ceil((Math.random() * 4)) + 3)], [(Math.ceil((Math.random() * 4)) + 4)], [(Math.ceil((Math.random() * 4)) + 3)], [(Math.ceil((Math.random() * 3)) + 3)], [(Math.ceil((Math.random() * 4)) + 4)]);
tiles = new Array();
freezey = false;
alphcount = 0;
woot = 0;
combo = 0;
offset = 0;
initgrid2();
blockermc2 = new blocker();
blockermc2.x = 0;
blockermc2.y = 0;
swi = new thing();
swi.w = 2;
swi.h = 6;
swi.x = (wid * swi.w);
swi.y = (wid * swi.h);
addChild(swi);
shifttimer = getTimer();
whabam = 500;
scoretext = new String();
levelinc = 0;
gpause = true;
sectime = 0;
gtime = 0;
gtimer = getTimer();
gamepause2();
origsong = true;
daalpha = 0.3;
addness = true;
stage.addEventListener(KeyboardEvent.KEY_DOWN, kdown2);
stage.addEventListener(KeyboardEvent.KEY_UP, kup2);
addEventListener(Event.ENTER_FRAME, oef2);
blockermc2.ddsp.cursong = defsong;
}
function frame2(){
stop();
skipb = new MovieClip();
skipt = new TextField();
skiptf = new TextFormat();
skiptf.font = "Arial Black";
skiptf.size = 20;
skiptf.color = 0xFFFFFF;
var _local2 = skipb.graphics;
with (_local2) {
lineStyle(0, 0xFFFFFF, 0);
drawRect(0, 0, 69, 50.5);
};
skipt.defaultTextFormat = skiptf;
skipt.text = ">>>";
skipt.x = 0;
skipt.selectable = false;
skipt.y = 0;
skipb.addChild(skipt);
addChild(skipb);
skipb.x = (stagewid - (skipb.width / 2));
skipb.y = 10;
skipb.addEventListener(MouseEvent.CLICK, skipbutton);
donut = new MovieClip();
donut.graphics.lineStyle(1, 8666142, 100);
donut.i = 94;
donut.xspot = 0;
donut.yspot = 0;
donut.xcoord = (donut.i + donut.xspot);
donut.ycoord = donut.yspot;
donut.graphics.beginFill(13726015, 100);
donut.graphics.moveTo(donut.xcoord, donut.ycoord);
donut.angle = 0;
while (donut.angle <= 360) {
donut.xcoord = ((Math.cos((donut.angle * (Math.PI / 180))) * donut.i) + donut.xspot);
donut.ycoord = ((Math.sin((donut.angle * (Math.PI / 180))) * donut.i) + donut.yspot);
donut.graphics.lineTo(donut.xcoord, donut.ycoord);
donut.angle++;
};
donut.graphics.endFill();
donut.graphics.beginFill(6707552, 100);
donut.graphics.moveTo(-87, -35);
donut.graphics.curveTo(-55, -89, 9, -93);
donut.graphics.curveTo(48, -85, 61, -71);
donut.graphics.curveTo(90, -40, 92, 16);
donut.graphics.curveTo(89, 37, 68, 64);
donut.graphics.curveTo(15, 120, -59, 65);
donut.graphics.curveTo(-98, 22, -87, -35);
donut.i = 35;
donut.xspot = 0;
donut.yspot = 0;
donut.xcoord = (donut.i + donut.xspot);
donut.ycoord = donut.yspot;
donut.graphics.beginFill(11097893, 100);
donut.graphics.moveTo(donut.xcoord, donut.ycoord);
donut.angle = 0;
while (donut.angle <= 360) {
donut.xcoord = ((Math.cos((donut.angle * (Math.PI / 180))) * donut.i) + donut.xspot);
donut.ycoord = ((Math.sin((donut.angle * (Math.PI / 180))) * donut.i) + donut.yspot);
donut.graphics.lineTo(donut.xcoord, donut.ycoord);
donut.angle++;
};
donut.i = 32.25;
donut.xspot = 0;
donut.yspot = 0;
donut.xcoord = (donut.i + donut.xspot);
donut.ycoord = donut.yspot;
donut.graphics.beginFill(0, 100);
donut.graphics.moveTo(donut.xcoord, donut.ycoord);
donut.angle = 0;
while (donut.angle <= 360) {
donut.xcoord = ((Math.cos((donut.angle * (Math.PI / 180))) * donut.i) + donut.xspot);
donut.ycoord = ((Math.sin((donut.angle * (Math.PI / 180))) * donut.i) + donut.yspot);
donut.graphics.lineTo(donut.xcoord, donut.ycoord);
donut.angle++;
};
covermc = new MovieClip();
covermc.graphics.moveTo(0, 0);
covermc.graphics.beginFill(0);
covermc.graphics.drawRect(0, 0, stagewid, stagehei);
covermc.alpha = 0;
donut.x = -300;
donut.y = (stagehei + 300);
addChild(donut);
donut.xTarget = (stagewid / 2);
donut.yTarget = (stagehei / 2);
donut.xSpeed = 0;
donut.ySpeed = 0;
donut.Mode = 1;
donut.Speed = 10;
donut.Stop = 1.2;
donut.blarg = 0;
tfilter = new GlowFilter(0xFFFFFF, 0.5, 5, 5, 150, 1);
dtext = new TextField();
dformat = new TextFormat();
dtext.selectable = false;
dformat.font = "Impact";
dformat.size = 43;
dformat.color = "0x000000";
dtext.defaultTextFormat = dformat;
dtext.width = 263;
dtext.height = 55;
dtext.x = ((stagewid / 2) - (dtext.width / 2));
dtext.y = ((stagehei / 2) + 50);
dtext.text = "DONUTMASTER";
addChild(dtext);
dtext.filters = [tfilter];
stage.addEventListener(Event.ENTER_FRAME, inoef);
dsound = new dintro();
ds = dsound.play();
donut.addEventListener(MouseEvent.CLICK, donutclick);
}
function frame4(){
stop();
defsong = 30000;
classicmode = false;
crazycombo = false;
timetrial = false;
missionmode = false;
structions = false;
hselect = false;
yorig1 = top1.y;
yorig2 = bot1.y;
yspot1 = yorig1;
yspot2 = yorig2;
stage.addEventListener(Event.ENTER_FRAME, menuoef);
stage.addEventListener(MouseEvent.CLICK, menuclick);
}
function frame3(){
menusound = new menusong();
menusc = menusound.play();
menusc.addEventListener(Event.SOUND_COMPLETE, mscdone);
nextFrame();
}
public function mscdone(_arg1){
menusc = menusound.play();
menusc.removeEventListener(Event.SOUND_COMPLETE, mscdone);
menusc.addEventListener(Event.SOUND_COMPLETE, mscdone);
}
public function initgrid(){
var _local1:MovieClip;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local1 = new MovieClip();
_local1.name = "Grid";
_local1.graphics.lineStyle(1, 0xFFFFFF, 0.1);
_local2 = 0;
while (_local2 < 6) {
_local3 = 0;
while (_local3 < 13) {
_local1.graphics.drawRect((_local2 * wid), (_local3 * wid), wid, wid);
if (_local3 > starthei[_local2]){
_local4 = Math.ceil((Math.random() * 5));
if (((!((grid[_local3][(_local2 - 1)] == _local4))) || (!((grid[_local3][(_local2 - 2)] == _local4))))){
grid[_local3][_local2] = _local4;
} else {
if (_local4 < 4){
grid[_local3][_local2] = (_local4 + 1);
} else {
grid[_local3][_local2] = (_local4 - 1);
};
};
_local5 = grid[_local3][_local2];
if (((!((grid[(_local3 - 1)][_local2] == _local5))) || (!((grid[(_local3 - 2)][_local2] == _local5))))){
} else {
if (_local5 < 4){
if (((!((grid[_local3][(_local2 - 1)] == (_local5 + 1)))) || (!((grid[_local3][(_local2 - 2)] == (_local5 + 1)))))){
grid[_local3][_local2] = (_local5 + 1);
} else {
if (_local5 < 3){
grid[_local3][_local2] = (_local5 + 2);
} else {
grid[_local3][_local2] = (_local5 - 1);
};
};
} else {
if (((!((grid[_local3][(_local2 - 1)] == (_local5 - 1)))) || (!((grid[_local3][(_local2 - 2)] == (_local5 - 1)))))){
grid[_local3][_local2] = (_local5 - 1);
} else {
grid[_local3][_local2] = (_local5 - 2);
};
};
};
if (grid[_local3][_local2] != 0){
if ((((grid[_local3][(_local2 - 1)] == grid[_local3][(_local2 - 2)])) && ((grid[_local3][(_local2 - 1)] == grid[_local3][_local2])))){
trace("Horizontal Prob");
};
if ((((grid[(_local3 - 1)][_local2] == grid[(_local3 - 2)][_local2])) && ((grid[(_local3 - 1)][_local2] == grid[_local3][_local2])))){
trace("Vertical Prob");
};
} else {
trace("Wtf hole");
};
};
_local3++;
};
_local2++;
};
addChild(_local1);
gridify();
starthei.push(_local1);
}
function frame8(){
stop();
yorig1 = top1.y;
yorig2 = bot1.y;
yspot1 = yorig1;
yspot2 = yorig2;
stage.addEventListener(Event.ENTER_FRAME, gomenuoef);
if (crazycombo){
blockermc2.ddsp.loopy = true;
combobox.text = maxc2.toString();
} else {
blockermc.ddsp.loopy = true;
combobox.text = maxc1.toString();
};
stage.addEventListener(MouseEvent.CLICK, gomenuclick);
}
public function kup2(_arg1:KeyboardEvent){
curdown = false;
_arg1.keyCode = 0;
}
function frame6(){
stop();
maxc1 = 0;
maxc2 = 0;
cover = new shaloop();
sndpos = 0;
if (!missionmode){
cover.x = 300;
cover.y = 300;
addChild(cover);
if (timetrial){
cover.gotoAndStop(2);
} else {
cover.gotoAndStop(1);
};
};
raisecount = 0;
ohcrap = false;
wid = 50;
score = 0;
level = 1;
shiftedw = new Array();
shiftedh = new Array();
grid = new Array([0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]);
starthei = new Array([(Math.ceil((Math.random() * 3)) + 4)], [(Math.ceil((Math.random() * 4)) + 3)], [(Math.ceil((Math.random() * 4)) + 4)], [(Math.ceil((Math.random() * 4)) + 3)], [(Math.ceil((Math.random() * 3)) + 3)], [(Math.ceil((Math.random() * 4)) + 4)]);
tiles = new Array();
freezey = false;
alphcount = 0;
woot = 0;
combo = 1;
chaining = false;
offset = 0;
initgrid();
blockermc = new blocker();
blockermc.x = 0;
blockermc.y = 0;
if (missionmode){
newmission();
};
swi = new thing();
swi.w = 2;
swi.h = 6;
swi.x = (wid * swi.w);
swi.y = (wid * swi.h);
addChild(swi);
curdown = false;
shifttimer = getTimer();
whabam = 500;
scoretext = new String();
levelinc = 0;
gpause = true;
sectime = 0;
gtime = 0;
gtimer = getTimer();
if (timetrial){
tttimer = 180;
};
if (missionmode){
tttimer = 120;
};
gamepause();
origsong = true;
daalpha = 0.3;
addness = true;
stage.addEventListener(KeyboardEvent.KEY_DOWN, kdown);
stage.addEventListener(KeyboardEvent.KEY_UP, kup);
addEventListener(Event.ENTER_FRAME, oef);
blockermc.ddsp.cursong = defsong;
}
public function initgrid2(){
var _local1:MovieClip;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local1 = new MovieClip();
_local1.name = "Grid";
_local1.graphics.lineStyle(1, 0xFFFFFF, 0.1);
_local2 = 0;
while (_local2 < 6) {
_local3 = 0;
while (_local3 < 13) {
_local1.graphics.drawRect((_local2 * wid), (_local3 * wid), wid, wid);
if (_local3 > starthei[_local2]){
_local4 = Math.ceil((Math.random() * 5));
if (((!((grid[_local3][(_local2 - 1)] == _local4))) || (!((grid[_local3][(_local2 - 2)] == _local4))))){
grid[_local3][_local2] = _local4;
} else {
if (_local4 < 4){
grid[_local3][_local2] = (_local4 + 1);
} else {
grid[_local3][_local2] = (_local4 - 1);
};
};
_local5 = grid[_local3][_local2];
if (((!((grid[(_local3 - 1)][_local2] == _local5))) || (!((grid[(_local3 - 2)][_local2] == _local5))))){
} else {
if (_local5 < 4){
if (((!((grid[_local3][(_local2 - 1)] == (_local5 + 1)))) || (!((grid[_local3][(_local2 - 2)] == (_local5 + 1)))))){
grid[_local3][_local2] = (_local5 + 1);
} else {
if (_local5 < 3){
grid[_local3][_local2] = (_local5 + 2);
} else {
grid[_local3][_local2] = (_local5 - 1);
};
};
} else {
if (((!((grid[_local3][(_local2 - 1)] == (_local5 - 1)))) || (!((grid[_local3][(_local2 - 2)] == (_local5 - 1)))))){
grid[_local3][_local2] = (_local5 - 1);
} else {
grid[_local3][_local2] = (_local5 - 2);
};
};
};
if (grid[_local3][_local2] != 0){
if ((((grid[_local3][(_local2 - 1)] == grid[_local3][(_local2 - 2)])) && ((grid[_local3][(_local2 - 1)] == grid[_local3][_local2])))){
trace("Horizontal Prob");
};
if ((((grid[(_local3 - 1)][_local2] == grid[(_local3 - 2)][_local2])) && ((grid[(_local3 - 1)][_local2] == grid[_local3][_local2])))){
trace("Vertical Prob");
};
} else {
trace("Wtf hole");
};
};
_local3++;
};
_local2++;
};
addChild(_local1);
gridify2();
starthei.push(_local1);
}
public function chain(_arg1, _arg2, _arg3){
var tileoef:Function;
var w = _arg1;
var h = _arg2;
var l = _arg3;
tileoef = function (_arg1:Event){
if (!gpause){
if (_arg1.target.alpha <= 0){
grid[h][w] = 0;
woot = (woot + 1);
score = (score + (25 * combo));
if (woot >= alphcount){
freezey = false;
};
chaining = true;
_arg1.target.buhbye = false;
_arg1.target.removeEventListener(Event.ENTER_FRAME, tileoef);
} else {
_arg1.target.alpha = (_arg1.target.alpha - 0.02);
};
};
if (ohcrap){
_arg1.target.removeEventListener(Event.ENTER_FRAME, tileoef);
};
};
if (tiles[((w * 13) + h)].buhbye == false){
freezey = true;
alphcount++;
tiles[((w * 13) + h)].inplay = false;
tiles[((w * 13) + h)].alpha = 1;
tiles[((w * 13) + h)].h = h;
tiles[((w * 13) + h)].w = w;
tiles[((w * 13) + h)].l = l;
tiles[((w * 13) + h)].addEventListener(Event.ENTER_FRAME, tileoef);
effectness((tiles[((w * 13) + h)].x + 25), (tiles[((w * 13) + h)].y + 25), (grid[h][w] + 1));
tiles[((w * 13) + h)].buhbye = true;
};
}
public function missioncomplete(){
tttimer = (tttimer + 15);
score = (score + 250);
newmission();
}
public function ungamepause(){
gpause = false;
blockermc.parent.removeChild(blockermc);
}
public function gridshift2(){
var _local1:Boolean;
var _local2:Number;
var _local3:Number;
if (((!(freezey)) && (!(ohcrap)))){
shiftedw = new Array();
shiftedh = new Array();
if (level > 25){
offset = (offset + ((2 + level) - 25));
} else {
offset = (offset + 2);
};
_local1 = false;
_local2 = 0;
while (_local2 < 6) {
_local3 = 0;
while (_local3 < 13) {
if (tiles[((_local2 * 13) + _local3)] != undefined){
if (offset >= 50){
tiles[((_local2 * 13) + _local3)].y = tiles[((_local2 * 13) + _local3)].origy;
if (_local3 < 12){
if (_local3 == 0){
if (grid[_local3][_local2] != 0){
_local1 = true;
};
};
grid[_local3][_local2] = grid[(_local3 + 1)][_local2];
};
} else {
tiles[((_local2 * 13) + _local3)].y = (tiles[((_local2 * 13) + _local3)].origy - offset);
};
tiles[((_local2 * 13) + _local3)].buhbye = false;
tiles[((_local2 * 13) + _local3)].alpha = 0.5;
};
_local3++;
};
_local2++;
};
if (_local1 == true){
freezey = true;
gameover2();
} else {
if (offset >= 50){
linecheck();
moar();
if (swi.h > 0){
swi.h = (swi.h - 1);
};
offset = 0;
};
};
};
}
public function pout(_arg1:MouseEvent){
loadbar.alpha = (loadbar.alpha + 0.5);
}
public function proll(_arg1:MouseEvent){
loadbar.alpha = (loadbar.alpha - 0.5);
}
public function oef2(_arg1:Event){
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
if (!ohcrap){
if (combo > maxc2){
maxc2 = combo;
};
maxcombobox.text = maxc2.toString();
if (((((!(gpause)) && (!(freezey)))) && (((getTimer() - gtimer) >= 1000)))){
sectime++;
gtimer = getTimer();
};
if (sectime >= 60){
gtime++;
sectime = 0;
};
if (sectime < 10){
timebox.text = ((gtime.toString() + ":0") + sectime.toString());
} else {
timebox.text = ((gtime.toString() + ":") + sectime.toString());
};
combobox.text = ("Combo: " + combo.toString());
scoretext = "";
_local2 = score.toString().length;
while (_local2 < 6) {
scoretext = (scoretext + "0");
_local2++;
};
if (!gpause){
blockermc2.ddsp.yspot = blockermc2.ddsp.origy;
levelbox.text = level.toString();
scorebox.text = (scoretext + score.toString());
levelinc++;
if (levelinc >= 1000){
level = (level + 1);
levelinc = 0;
};
whabam = (500 - (level * 20));
if (!freezey){
if ((getTimer() - shifttimer) > whabam){
gridshift2();
shifttimer = getTimer();
};
starthei[(starthei.length - 1)].y = -(offset);
};
swi.x = (wid * swi.w);
swi.y = ((wid * swi.h) - offset);
_local3 = 0;
_local4 = 11;
while (_local4 > -1) {
_local5 = 5;
while (_local5 > -1) {
if (grid[_local4][_local5] != 0){
if (grid[(_local4 + 1)][_local5] == 0){
_local3 = 1;
grid[(_local4 + 1)][_local5] = grid[_local4][_local5];
grid[_local4][_local5] = 0;
gridify2();
};
};
_local5--;
};
_local4--;
};
if (!freezey){
if (_local3 == 0){
linecheck2();
};
};
};
};
_local5 = 0;
while (_local5 < 6) {
_local4 = 0;
while (_local4 < 13) {
if (grid[1][_local5] != 0){
if (tiles[((_local5 * 13) + _local4)].buhbye == false){
tiles[((_local5 * 13) + _local4)].alpha = daalpha;
};
} else {
if (tiles[((_local5 * 13) + _local4)].buhbye == false){
tiles[((_local5 * 13) + _local4)].alpha = 0.5;
};
};
_local4++;
};
_local5++;
};
if (addness){
daalpha = (daalpha + 0.025);
} else {
daalpha = (daalpha - 0.025);
};
if (daalpha <= 0.4){
addness = true;
};
if (daalpha >= 0.6){
addness = false;
};
}
public function ungamepause2(){
gpause = false;
blockermc2.parent.removeChild(blockermc2);
}
public function gridshift(){
var _local1:Boolean;
var _local2:Number;
var _local3:Number;
if (((!(freezey)) && (!(ohcrap)))){
shiftedw = new Array();
shiftedh = new Array();
if (level > 25){
offset = (offset + (2 + ((level - 25) / 2)));
} else {
offset = (offset + 2);
};
_local1 = false;
_local2 = 0;
while (_local2 < 6) {
_local3 = 0;
while (_local3 < 13) {
if (tiles[((_local2 * 13) + _local3)] != undefined){
if (offset >= 50){
tiles[((_local2 * 13) + _local3)].y = tiles[((_local2 * 13) + _local3)].origy;
if (_local3 < 12){
if (_local3 == 0){
if (grid[_local3][_local2] != 0){
_local1 = true;
};
};
grid[_local3][_local2] = grid[(_local3 + 1)][_local2];
};
} else {
tiles[((_local2 * 13) + _local3)].y = (tiles[((_local2 * 13) + _local3)].origy - offset);
};
tiles[((_local2 * 13) + _local3)].buhbye = false;
tiles[((_local2 * 13) + _local3)].alpha = 0.5;
};
_local3++;
};
_local2++;
};
if (_local1 == true){
freezey = true;
gameover();
} else {
if (offset >= 50){
linecheck();
moar();
if (swi.h > 0){
swi.h = (swi.h - 1);
};
offset = 0;
};
};
};
}
public function gridify2(){
var _local1:Number;
var _local2:Number;
var _local3:MovieClip;
_local1 = 0;
while (_local1 < 6) {
_local2 = 0;
while (_local2 < 13) {
if (tiles[((_local1 * 13) + _local2)] == undefined){
_local3 = new tile();
_local3.gotoAndStop(1);
_local3.datile.tilemc.gotoAndStop((grid[_local2][_local1] + 1));
_local3.x = (_local1 * wid);
_local3.y = (_local2 * wid);
_local3.origy = _local3.y;
_local3.alpha = 0.5;
_local3.width = (_local3.height = wid);
addChild(_local3);
tiles.push(_local3);
} else {
tiles[((_local1 * 13) + _local2)].gotoAndStop(1);
tiles[((_local1 * 13) + _local2)].datile.tilemc.gotoAndStop((grid[_local2][_local1] + 1));
};
_local2++;
};
_local1++;
};
}
public function tileswap2(){
var _local1:Number;
var _local2:Number;
if (((!(tiles[((swi.w * 13) + swi.h)].buhbye)) && (!(tiles[(((swi.w + 1) * 13) + swi.h)].buhbye)))){
_local1 = grid[swi.h][swi.w];
_local2 = grid[swi.h][(swi.w + 1)];
grid[swi.h][swi.w] = _local2;
grid[swi.h][(swi.w + 1)] = _local1;
gridify2();
};
}
public function linecheck2(){
var _local1:Array;
var _local2:Array;
var _local3:Array;
var _local4:Boolean;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
_local1 = new Array();
_local2 = new Array();
_local3 = new Array();
_local4 = false;
_local5 = 0;
while (_local5 < 13) {
_local6 = 0;
_local7 = 0;
_local8 = 0;
while (_local8 <= 6) {
if (((((!((grid[_local5][_local8] == 0))) && ((_local7 == grid[_local5][_local8])))) && (!((_local8 == 6))))){
_local6 = (_local6 + 1);
} else {
if (_local6 >= 2){
_local9 = 0;
while (_local9 <= _local6) {
if (tiles[((((_local8 - 1) - _local9) * 13) + _local5)].buhbye == false){
_local1.push(_local5);
_local2.push(((_local8 - 1) - _local9));
};
_local9++;
};
_local4 = true;
};
_local6 = 0;
};
_local7 = grid[_local5][_local8];
_local8++;
};
_local5++;
};
_local8 = 0;
while (_local8 <= 6) {
_local10 = 0;
_local7 = 0;
_local5 = 0;
while (_local5 < grid.length) {
if (((((!((grid[_local5][_local8] == 0))) && ((_local7 == grid[_local5][_local8])))) && (!((_local5 == 12))))){
_local10 = (_local10 + 1);
} else {
if (_local10 >= 2){
_local9 = 0;
while (_local9 <= _local10) {
if (tiles[((((_local8 * 13) + _local5) - 1) - _local9)].buhbye == false){
_local1.push(((_local5 - 1) - _local9));
_local2.push(_local8);
};
_local9++;
};
_local4 = true;
};
_local10 = 0;
};
_local7 = grid[_local5][_local8];
_local5++;
};
_local8++;
};
if (_local4){
if (_local1.length > 2){
combo = (combo + 1);
};
_local11 = 0;
while (_local11 < _local1.length) {
_local12 = ((_local2[_local11] * 13) + _local1[_local11]);
chain2(_local2[_local11], _local1[_local11], 0);
_local11++;
};
_local4 = false;
} else {
combo = 0;
};
gridify2();
}
public function moar2(){
var _local1:Number;
var _local2:Number;
var _local3:Number;
gridify2();
_local1 = 0;
while (_local1 < 6) {
_local2 = 12;
_local3 = Math.ceil((Math.random() * 5));
if (((!((grid[_local2][(_local1 - 1)] == _local3))) || (!((grid[_local2][(_local1 - 2)] == _local3))))){
grid[_local2][_local1] = _local3;
} else {
if (grid[_local2][_local1] != 0){
if (_local3 < 5){
grid[_local2][_local1] = (_local3 + 1);
} else {
grid[_local2][_local1] = (_local3 - 1);
};
};
};
_local1++;
};
gridify2();
}
public function mclick(_arg1:MouseEvent){
prevFrame();
mb.removeEventListener(MouseEvent.CLICK, mclick);
}
public function gamepause(){
gpause = true;
addChild(blockermc);
}
public function menusplode(_arg1, _arg2, _arg3){
var randomrot:Number;
var ra:Number;
var r:Number;
var effectmove:Function;
var mc:MovieClip;
var dax = _arg1;
var day = _arg2;
var daframe = _arg3;
effectmove = function (_arg1:Event){
_arg1.target.alpha = (_arg1.target.alpha + 0.02);
_arg1.target.x = (_arg1.target.x + (Math.cos(((_arg1.target.rotation * Math.PI) / 180)) * 20));
_arg1.target.y = (_arg1.target.y + (Math.sin(((_arg1.target.rotation * Math.PI) / 180)) * 20));
if (((((((((((((((((classicmode) || (crazycombo))) || (timetrial))) || (missionmode))) || (structions))) || ((_arg1.target.x < -20)))) || ((_arg1.target.x > (stagewid + 20))))) || ((_arg1.target.y < -20)))) || ((_arg1.target.y > (stagehei + 20))))){
_arg1.target.parent.removeChild(_arg1.target);
_arg1.target.removeEventListener(Event.ENTER_FRAME, effectmove);
};
};
randomrot = (Math.random() * 360);
ra = ((Math.random() * 6) + 5);
r = 0;
while (r < ra) {
mc = new tilepiece();
mc.x = dax;
mc.y = day;
addChild(mc);
mc.alpha = 0;
mc.width = (mc.height = ((Math.random() * 5) + 5));
mc.rotation = (randomrot + ((360 / ra) * r));
mc.gotoAndStop(daframe);
mc.addEventListener(Event.ENTER_FRAME, effectmove);
r = (r + 1);
};
}
public function tileswap(){
var _local1:Number;
var _local2:Number;
if (((!(tiles[((swi.w * 13) + swi.h)].buhbye)) && (!(tiles[(((swi.w + 1) * 13) + swi.h)].buhbye)))){
_local1 = grid[swi.h][swi.w];
_local2 = grid[swi.h][(swi.w + 1)];
grid[swi.h][swi.w] = _local2;
grid[swi.h][(swi.w + 1)] = _local1;
gridify();
};
}
public function oef(_arg1:Event){
var _local2:Number;
var _local3:Number;
var _local4:Boolean;
var _local5:Number;
var _local6:Number;
if (combo > maxc1){
maxc1 = combo;
};
maxcombobox.text = maxc1.toString();
if (((!(gpause)) && (((getTimer() - gtimer) >= 1000)))){
if (((timetrial) || (missionmode))){
tttimer = (tttimer - 1);
};
sectime++;
gtimer = getTimer();
};
if (sectime >= 60){
gtime++;
sectime = 0;
};
if (((timetrial) || (missionmode))){
if ((((tttimer / 60) - Math.floor((tttimer / 60))) * 60) < 10){
timeleft.text = ((Math.floor((tttimer / 60)) + ":0") + Math.round((((tttimer / 60) - Math.floor((tttimer / 60))) * 60)));
} else {
timeleft.text = ((Math.floor((tttimer / 60)) + ":") + Math.round((((tttimer / 60) - Math.floor((tttimer / 60))) * 60)));
};
};
if (sectime < 10){
timebox.text = ((gtime.toString() + ":0") + sectime.toString());
} else {
timebox.text = ((gtime.toString() + ":") + sectime.toString());
};
combobox.text = ("Combo: " + combo.toString());
scoretext = "";
_local2 = score.toString().length;
while (_local2 < 6) {
scoretext = (scoretext + "0");
_local2++;
};
levelbox.text = level.toString();
scorebox.text = (scoretext + score.toString());
if (((!(gpause)) && (!(ohcrap)))){
blockermc.ddsp.yspot = blockermc.ddsp.origy;
if (missionmode){
if (mission == 1){
if ((raisecount / 8) >= raisemax){
missioncomplete();
};
};
if (mission == 4){
if (combo >= mishcomb){
missioncomplete();
};
};
};
levelinc++;
if (levelinc >= 1000){
level = (level + 1);
levelinc = 0;
};
whabam = (500 - (level * 20));
if (!freezey){
if ((getTimer() - shifttimer) > whabam){
gridshift();
shifttimer = getTimer();
};
starthei[(starthei.length - 1)].y = -(offset);
};
swi.x = (wid * swi.w);
swi.y = ((wid * swi.h) - offset);
_local3 = 0;
_local4 = false;
_local5 = 11;
while (_local5 > -1) {
if (grid[_local5][mishcolumn] != 0){
_local4 = true;
};
_local6 = 5;
while (_local6 > -1) {
if (grid[_local5][_local6] != 0){
if (grid[(_local5 + 1)][_local6] == 0){
if (chaining){
shiftedw.push(_local6);
shiftedh.push((_local5 + 1));
};
_local3 = 1;
grid[(_local5 + 1)][_local6] = grid[_local5][_local6];
grid[_local5][_local6] = 0;
gridify();
};
};
_local6--;
};
_local5--;
};
if (((missionmode) && ((mission == 5)))){
if (_local4 == false){
missioncomplete();
};
};
if (!freezey){
if (_local3 == 0){
chaining = false;
linecheck();
};
};
};
if (((missionmode) || (timetrial))){
if (tttimer <= 0){
gameover();
};
};
_local6 = 0;
while (_local6 < 6) {
_local5 = 0;
while (_local5 < 13) {
if (grid[1][_local6] != 0){
if (tiles[((_local6 * 13) + _local5)].buhbye == false){
tiles[((_local6 * 13) + _local5)].alpha = daalpha;
};
} else {
if (tiles[((_local6 * 13) + _local5)].buhbye == false){
tiles[((_local6 * 13) + _local5)].alpha = 0.5;
};
};
_local5++;
};
_local6++;
};
if (addness){
daalpha = (daalpha + 0.025);
} else {
daalpha = (daalpha - 0.025);
};
if (daalpha <= 0.4){
addness = true;
};
if (daalpha >= 0.6){
addness = false;
};
}
public function moar(){
var _local1:Number;
var _local2:Number;
var _local3:Number;
gridify();
_local1 = 0;
while (_local1 < 6) {
_local2 = 12;
_local3 = Math.ceil((Math.random() * 5));
if (((!((grid[_local2][(_local1 - 1)] == _local3))) || (!((grid[_local2][(_local1 - 2)] == _local3))))){
grid[_local2][_local1] = _local3;
} else {
if (grid[_local2][_local1] != 0){
if (_local3 < 5){
grid[_local2][_local1] = (_local3 + 1);
} else {
grid[_local2][_local1] = (_local3 - 1);
};
};
};
_local1++;
};
gridify();
}
public function gameover2(){
var _local1:Number;
var _local2:Number;
ohcrap = true;
_local1 = 0;
while (_local1 < 6) {
_local2 = 0;
while (_local2 < 13) {
grid[_local2][_local1] = 0;
if (tiles[((_local1 * 13) + _local2)] != undefined){
tiles[((_local1 * 13) + _local2)].parent.removeChild(tiles[((_local1 * 13) + _local2)]);
};
_local2++;
};
_local1++;
};
swi.parent.removeChild(swi);
starthei[6].parent.removeChild(starthei[6]);
if (gpause){
blockermc2.parent.removeChild(blockermc2);
};
stage.removeEventListener(KeyboardEvent.KEY_DOWN, kdown2);
stage.removeEventListener(KeyboardEvent.KEY_UP, kup2);
removeEventListener(Event.ENTER_FRAME, oef2);
gotoAndStop(8);
}
public function skipbutton(_arg1:MouseEvent){
donut.removeEventListener(MouseEvent.CLICK, donutclick);
nextFrame();
ds.stop();
donut.parent.removeChild(donut);
dtext.parent.removeChild(dtext);
stage.removeEventListener(Event.ENTER_FRAME, inoef);
skipb.removeChild(skipt);
skipb.parent.removeChild(skipb);
skipb.removeEventListener(MouseEvent.CLICK, skipbutton);
}
public function gamepause2(){
gpause = true;
addChild(blockermc2);
}
public function effectness(_arg1, _arg2, _arg3){
var randomrot:Number;
var ra:Number;
var r:Number;
var effectmove:Function;
var mc:MovieClip;
var dax = _arg1;
var day = _arg2;
var daframe = _arg3;
effectmove = function (_arg1:Event){
if (!gpause){
_arg1.target.x = (_arg1.target.x + (Math.cos(((_arg1.target.rotation * Math.PI) / 180)) * 20));
_arg1.target.y = (_arg1.target.y + (Math.sin(((_arg1.target.rotation * Math.PI) / 180)) * 20));
};
if (((((((((ohcrap) || ((_arg1.target.x < -20)))) || ((_arg1.target.x > (stage.stageWidth + 20))))) || ((_arg1.target.y < -20)))) || ((_arg1.target.y > (stage.stageHeight + 20))))){
_arg1.target.parent.removeChild(_arg1.target);
_arg1.target.removeEventListener(Event.ENTER_FRAME, effectmove);
};
};
randomrot = (Math.random() * 360);
ra = ((Math.random() * 8) + 7);
r = 0;
while (r < ra) {
mc = new tilepiece();
mc.x = dax;
mc.y = day;
addChild(mc);
mc.alpha = 0.7;
mc.width = (mc.height = ((Math.random() * 5) + 5));
mc.rotation = (randomrot + ((360 / ra) * r));
mc.gotoAndStop(daframe);
mc.addEventListener(Event.ENTER_FRAME, effectmove);
r = (r + 1);
};
}
public function menuclick(_arg1:MouseEvent){
var _local2:Number;
var _local3:Number;
_local2 = 0;
_local3 = 1;
while (_local3 <= 6) {
if (this[("b" + _local3)].hitTestPoint(mouseX, mouseY, true)){
_local2 = _local3;
};
_local3++;
};
if (_local2 == 1){
if (!hselect){
classicmode = true;
gotoAndStop(6);
} else {
daURL = new URLRequest("http://rankz.armorbot.com/QBClassic/");
};
};
if (_local2 == 2){
if (!hselect){
crazycombo = true;
gotoAndStop(7);
} else {
daURL = new URLRequest("http://rankz.armorbot.com/QBCC/");
};
};
if (_local2 == 4){
if (!hselect){
timetrial = true;
gotoAndStop(6);
} else {
daURL = new URLRequest("http://rankz.armorbot.com/QBTimeTrial/");
};
};
if (_local2 == 3){
if (!hselect){
missionmode = true;
gotoAndStop(6);
} else {
daURL = new URLRequest("http://rankz.armorbot.com/QBMissionMode/");
};
};
if (_local2 == 5){
structions = true;
nextFrame();
};
if (_local2 == 6){
if (hselect){
hselect = false;
} else {
hselect = true;
};
} else {
if (_local2 != 0){
if (((!(hselect)) || ((_local2 == 5)))){
if (_local2 != 5){
menusc.stop();
menusc.removeEventListener(Event.SOUND_COMPLETE, mscdone);
};
stage.removeEventListener(Event.ENTER_FRAME, menuoef);
stage.removeEventListener(MouseEvent.CLICK, menuclick);
} else {
navigateToURL(daURL);
hselect = false;
};
};
};
}
public function menuoef(_arg1:Event){
var _local2:Boolean;
var _local3:Number;
menusplode((stagewid / 2), (stagehei / 2), Math.ceil((Math.random() * 6)));
_local2 = false;
_local3 = 1;
while (_local3 <= 6) {
if (this[("b" + _local3)].hitTestPoint(mouseX, mouseY, true)){
this[("b" + _local3)].alpha = 0.2;
_local2 = true;
yspot1 = ((this[("b" + _local3)].y - (this[("b" + _local3)].height / 2)) + (top1.height / 2));
yspot2 = ((this[("b" + _local3)].y + (this[("b" + _local3)].height / 2)) - (top1.height / 2));
} else {
if ((((_local3 <= 4)) && (hselect))){
this[("b" + _local3)].alpha = 0.6;
} else {
this[("b" + _local3)].alpha = 0.01;
};
};
_local3++;
};
if (!_local2){
yspot1 = yorig1;
yspot2 = yorig2;
};
top1.y = (top1.y - ((top1.y - yspot1) / 5));
bot1.y = (bot1.y - ((bot1.y - yspot2) / 5));
}
public function gomenuclick(_arg1:MouseEvent){
var _local2:Number;
var _local3:Number;
_local2 = 0;
_local3 = 1;
while (_local3 <= 3) {
if (this[("b" + _local3)].hitTestPoint(mouseX, mouseY, true)){
_local2 = _local3;
};
_local3++;
};
if (_local2 == 1){
if (namebox.text != ""){
submit();
};
};
if (_local2 == 3){
if (classicmode){
daURL = new URLRequest("http://rankz.armorbot.com/QBClassic/");
};
if (crazycombo){
daURL = new URLRequest("http://rankz.armorbot.com/QBCC/");
};
if (missionmode){
daURL = new URLRequest("http://rankz.armorbot.com/QBMissionMode/");
};
if (timetrial){
daURL = new URLRequest("http://rankz.armorbot.com/QBTimeTrial/");
};
navigateToURL(daURL, "_blank");
};
if ((((((_local2 == 1)) && (!((namebox.text == ""))))) || ((_local2 == 2)))){
if (crazycombo){
blockermc2.ddsp.removeness();
} else {
blockermc.ddsp.removeness();
};
gotoAndStop(3);
stage.removeEventListener(Event.ENTER_FRAME, gomenuoef);
stage.removeEventListener(MouseEvent.CLICK, gomenuclick);
};
}
public function pbutton(_arg1:MouseEvent){
nextFrame();
titlebox.parent.removeChild(titlebox);
loadbar.parent.removeChild(loadbar);
playbutton.parent.removeChild(playbutton);
playbutton.removeEventListener(MouseEvent.CLICK, pbutton);
playbutton.removeEventListener(MouseEvent.ROLL_OVER, proll);
playbutton.removeEventListener(MouseEvent.ROLL_OUT, pout);
loadbar.removeEventListener(MouseEvent.CLICK, pbutton);
loadbar.removeEventListener(MouseEvent.ROLL_OVER, proll);
loadbar.removeEventListener(MouseEvent.ROLL_OUT, pout);
}
public function donutclick(_arg1:MouseEvent){
if (skipb.hitTestPoint(mouseX, mouseY, true) == false){
NewgroundsAPI.loadMySite();
};
}
public function chain2(_arg1, _arg2, _arg3){
var tileoef2:Function;
var w = _arg1;
var h = _arg2;
var l = _arg3;
tileoef2 = function (_arg1:Event){
if (!gpause){
if (_arg1.target.alpha <= 0){
grid[h][w] = 0;
woot = (woot + 1);
score = (score + (25 * combo));
if (woot >= alphcount){
freezey = false;
};
_arg1.target.buhbye = false;
_arg1.target.removeEventListener(Event.ENTER_FRAME, tileoef2);
} else {
_arg1.target.alpha = (_arg1.target.alpha - 0.02);
};
};
};
if (tiles[((w * 13) + h)].buhbye == false){
freezey = true;
alphcount++;
tiles[((w * 13) + h)].alpha = 1;
tiles[((w * 13) + h)].h = h;
tiles[((w * 13) + h)].w = w;
tiles[((w * 13) + h)].l = l;
tiles[((w * 13) + h)].addEventListener(Event.ENTER_FRAME, tileoef2);
effectness2((tiles[((w * 13) + h)].x + 25), (tiles[((w * 13) + h)].y + 25), (grid[h][w] + 1));
tiles[((w * 13) + h)].buhbye = true;
};
}
public function linecheck(){
var _local1:Array;
var _local2:Array;
var _local3:Array;
var _local4:Boolean;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Boolean;
var _local12:Number;
var _local13:Number;
var _local14:Number;
_local1 = new Array();
_local2 = new Array();
_local3 = new Array();
_local4 = false;
_local5 = 0;
while (_local5 < 13) {
_local6 = 0;
_local7 = 0;
_local8 = 0;
while (_local8 <= 6) {
if (((((!((grid[_local5][_local8] == 0))) && ((_local7 == grid[_local5][_local8])))) && (!((_local8 == 6))))){
_local6 = (_local6 + 1);
} else {
if (_local6 >= 2){
_local9 = 0;
while (_local9 <= _local6) {
if (tiles[((((_local8 - 1) - _local9) * 13) + _local5)].inplay){
_local1.push(_local5);
_local2.push(((_local8 - 1) - _local9));
};
_local9++;
};
_local4 = true;
};
_local6 = 0;
};
_local7 = grid[_local5][_local8];
_local8++;
};
_local5++;
};
_local8 = 0;
while (_local8 <= 6) {
_local10 = 0;
_local7 = 0;
_local5 = 0;
while (_local5 < grid.length) {
if (((((!((grid[_local5][_local8] == 0))) && ((_local7 == grid[_local5][_local8])))) && (!((_local5 == 12))))){
_local10 = (_local10 + 1);
} else {
if (_local10 >= 2){
_local9 = 0;
while (_local9 <= _local10) {
if (tiles[((((_local8 * 13) + _local5) - 1) - _local9)].inplay){
_local1.push(((_local5 - 1) - _local9));
_local2.push(_local8);
};
_local9++;
};
_local4 = true;
};
_local10 = 0;
};
_local7 = grid[_local5][_local8];
_local5++;
};
_local8++;
};
if (_local4){
_local11 = false;
_local12 = 0;
while (_local12 < _local1.length) {
if (_local1.length > 2){
_local14 = 0;
while (_local14 < shiftedw.length) {
if ((((shiftedh[_local14] == _local1[_local12])) && ((shiftedw[_local14] == _local2[_local12])))){
_local11 = true;
};
_local14++;
};
};
_local12++;
};
if (_local11){
combo = (combo + 1);
};
_local12 = 0;
while (_local12 < _local1.length) {
chain(_local2[_local12], _local1[_local12], 0);
_local12++;
};
_local13 = 0;
if (missionmode == true){
if ((((mission == 0)) || ((mission == 2)))){
_local12 = 0;
while (_local12 < _local1.length) {
if (_local12 > 0){
if (mission == 0){
if (grid[_local1[_local12]][_local2[_local12]] != grid[_local1[(_local12 - 1)]][_local2[(_local12 - 1)]]){
missioncomplete();
};
};
};
if (mission == 2){
if (grid[_local1[_local12]][_local2[_local12]] == mishcolour){
_local13++;
};
};
_local12++;
};
if (mission == 2){
if (_local13 >= colamt){
missioncomplete();
};
};
};
if (mission == 3){
if (_local1.length >= colamt){
missioncomplete();
};
};
};
_local4 = false;
} else {
combo = 1;
};
shiftedw = new Array();
shiftedh = new Array();
gridify();
}
public function kdown(_arg1:KeyboardEvent){
if (!gpause){
if (_arg1.keyCode == 37){
if (swi.w > 0){
swi.w = (swi.w - 1);
};
};
if (_arg1.keyCode == 38){
if (swi.h > 0){
swi.h = (swi.h - 1);
};
};
if (_arg1.keyCode == 39){
if (swi.w < 4){
swi.w = (swi.w + 1);
};
};
if (_arg1.keyCode == 40){
if (swi.h < 11){
swi.h = (swi.h + 1);
};
};
if (_arg1.keyCode == 32){
if (offset >= 50){
gridshift();
};
tileswap();
};
if (_arg1.keyCode == 90){
if (((!(freezey)) && (!(ohcrap)))){
gridshift();
gridshift();
raisecount = (raisecount + 1);
};
};
if (((!(curdown)) && ((_arg1.keyCode == 80)))){
gamepause();
};
} else {
if (_arg1.keyCode == 81){
gameover();
};
if (((!(curdown)) && ((_arg1.keyCode == 80)))){
ungamepause();
};
};
curdown = true;
}
public function gomenuoef(_arg1:Event){
var _local2:Boolean;
var _local3:Number;
if (missionmode){
scorebox.text = ([((gtime * 60) + sectime)].toString() + " seconds");
} else {
scorebox.text = score.toString();
};
_local2 = false;
_local3 = 1;
while (_local3 <= 3) {
if (this[("b" + _local3)].hitTestPoint(mouseX, mouseY, true)){
_local2 = true;
yspot1 = ((this[("b" + _local3)].y - (this[("b" + _local3)].height / 2)) + (top1.height / 2));
yspot2 = ((this[("b" + _local3)].y + (this[("b" + _local3)].height / 2)) - (top1.height / 2));
};
_local3++;
};
if (!_local2){
yspot1 = yorig1;
yspot2 = yorig2;
};
top1.y = (top1.y - ((top1.y - yspot1) / 5));
bot1.y = (bot1.y - ((bot1.y - yspot2) / 5));
}
public function effectness2(_arg1, _arg2, _arg3){
var randomrot:Number;
var ra:Number;
var r:Number;
var effectmove:Function;
var mc:MovieClip;
var dax = _arg1;
var day = _arg2;
var daframe = _arg3;
effectmove = function (_arg1:Event){
if (!gpause){
_arg1.target.x = (_arg1.target.x + (Math.cos(((_arg1.target.rotation * Math.PI) / 180)) * 20));
_arg1.target.y = (_arg1.target.y + (Math.sin(((_arg1.target.rotation * Math.PI) / 180)) * 20));
};
if (((((((((ohcrap) || ((_arg1.target.x < -20)))) || ((_arg1.target.x > (stage.stageWidth + 20))))) || ((_arg1.target.y < -20)))) || ((_arg1.target.y > (stage.stageHeight + 20))))){
_arg1.target.parent.removeChild(_arg1.target);
_arg1.target.removeEventListener(Event.ENTER_FRAME, effectmove);
};
};
randomrot = (Math.random() * 360);
ra = ((Math.random() * 8) + 7);
r = 0;
while (r < ra) {
mc = new tilepiece();
mc.x = dax;
mc.y = day;
addChild(mc);
mc.alpha = 0.7;
mc.width = (mc.height = ((Math.random() * 5) + 5));
mc.rotation = (randomrot + ((360 / ra) * r));
mc.gotoAndStop(daframe);
mc.addEventListener(Event.ENTER_FRAME, effectmove);
r = (r + 1);
};
}
public function gameover(){
var _local1:Number;
var _local2:Number;
ohcrap = true;
_local1 = 0;
while (_local1 < 6) {
_local2 = 0;
while (_local2 < 13) {
grid[_local2][_local1] = 0;
if (tiles[((_local1 * 13) + _local2)] != undefined){
tiles[((_local1 * 13) + _local2)].parent.removeChild(tiles[((_local1 * 13) + _local2)]);
};
_local2++;
};
_local1++;
};
if (((!(missionmode)) && (!(crazycombo)))){
cover.parent.removeChild(cover);
};
swi.parent.removeChild(swi);
starthei[6].parent.removeChild(starthei[6]);
if (gpause){
blockermc.parent.removeChild(blockermc);
};
stage.removeEventListener(KeyboardEvent.KEY_DOWN, kdown);
stage.removeEventListener(KeyboardEvent.KEY_UP, kup);
removeEventListener(Event.ENTER_FRAME, oef);
gotoAndStop(8);
}
public function PL_LOADING(_arg1:ProgressEvent){
var pcent:Number;
var event = _arg1;
pcent = Math.floor(((loadbar.stagewid * event.bytesLoaded) / event.bytesTotal));
var _local3 = loadbar;
with (_local3) {
graphics.clear();
graphics.lineStyle(2, 0xFFFFFF, 0.4);
graphics.drawRect(0, 0, stagewid, 20);
graphics.beginFill(0xFFFFFF, 0.2);
graphics.drawRect(0, 0, pcent, 20);
graphics.endFill();
};
if (pcent == loadbar.stagewid){
addChild(playbutton);
playbutton.alpha = 0;
playbutton.x = (((-((loadbar.stagewid / 2)) + (loadbar.width / 2)) - (playbutton.width / 2)) + (stage.stageWidth / 2));
playbutton.y = (((stage.stageHeight / 2) + 125) + 20);
playbutton.addChild(ptext);
playbutton.addEventListener(MouseEvent.CLICK, pbutton);
playbutton.addEventListener(MouseEvent.ROLL_OVER, proll);
playbutton.addEventListener(MouseEvent.ROLL_OUT, pout);
loadbar.addEventListener(MouseEvent.CLICK, pbutton);
loadbar.addEventListener(MouseEvent.ROLL_OVER, proll);
loadbar.addEventListener(MouseEvent.ROLL_OUT, pout);
loaderInfo.removeEventListener(ProgressEvent.PROGRESS, PL_LOADING);
};
}
}
}//package QBsponsor_fla
Section 3
//NG_AD_OBJECT_1 (QBsponsor_fla.NG_AD_OBJECT_1)
package QBsponsor_fla {
import flash.events.*;
import flash.media.*;
import flash.display.*;
import flash.net.*;
import flash.text.*;
import flash.filters.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.geom.*;
import flash.printing.*;
import flash.system.*;
import flash.ui.*;
import flash.utils.*;
import flash.xml.*;
public dynamic class NG_AD_OBJECT_1 extends MovieClip {
public var ng_ad:MovieClip;
public var NG_Button:SimpleButton;
public function NG_AD_OBJECT_1(){
addFrameScript(0, frame1);
}
public function loadNGSite(_arg1:Event){
NewgroundsAPI.loadNewgrounds();
}
public function startAd(_arg1){
var _local2:URLLoader;
_local2 = new URLLoader(new URLRequest(_arg1));
_local2.addEventListener(Event.COMPLETE, ad_Loaded);
}
function frame1(){
Security.allowDomain("70.87.128.99");
Security.allowInsecureDomain("70.87.128.99");
Security.allowDomain("ads.shizmoo.com");
Security.allowInsecureDomain("ads.shizmoo.com");
Security.allowDomain("www.cpmstar.com");
Security.allowInsecureDomain("www.cpmstar.com");
Security.allowDomain("server.cpmstar.com");
Security.allowInsecureDomain("server.cpmstar.com");
if (NewgroundsAPI.getAdURL()){
startAd(NewgroundsAPI.getAdURL());
};
NewgroundsAPI.addEventListener(NewgroundsAPI.ADS_APPROVED, startAd);
NG_Button.addEventListener(MouseEvent.CLICK, loadNGSite);
stop();
}
public function ad_Loaded(_arg1:Event){
var _local2:*;
var _local3:Loader;
_local2 = String(_arg1.target.data);
_local3 = new Loader();
_local3.load(new URLRequest(_local2));
ng_ad.addChild(_local3);
}
}
}//package QBsponsor_fla
Section 4
//NG_TANK_3 (QBsponsor_fla.NG_TANK_3)
package QBsponsor_fla {
import flash.events.*;
import flash.display.*;
public dynamic class NG_TANK_3 extends MovieClip {
public var NG_Logo:SimpleButton;
public function NG_TANK_3(){
addFrameScript(0, frame1);
}
public function loadNGSite(_arg1:Event){
NewgroundsAPI.loadNewgrounds();
}
function frame1(){
NG_Logo.addEventListener(MouseEvent.CLICK, loadNGSite);
}
}
}//package QBsponsor_fla
Section 5
//tile_l_20 (QBsponsor_fla.tile_l_20)
package QBsponsor_fla {
import flash.display.*;
public dynamic class tile_l_20 extends MovieClip {
public var tilemc:tilepiece;
public function tile_l_20(){
addFrameScript(4, frame5);
}
function frame5(){
stop();
gotoAndStop(1);
}
}
}//package QBsponsor_fla
Section 6
//tile_r_19 (QBsponsor_fla.tile_r_19)
package QBsponsor_fla {
import flash.display.*;
public dynamic class tile_r_19 extends MovieClip {
public var tilemc:tilepiece;
public function tile_r_19(){
addFrameScript(4, frame5);
}
function frame5(){
stop();
gotoAndStop(1);
}
}
}//package QBsponsor_fla
Section 7
//tile_s_18 (QBsponsor_fla.tile_s_18)
package QBsponsor_fla {
import flash.display.*;
public dynamic class tile_s_18 extends MovieClip {
public var tilemc:tilepiece;
}
}//package QBsponsor_fla
Section 8
//blocker (blocker)
package {
import flash.display.*;
public dynamic class blocker extends MovieClip {
public var ddsp:MovieClip;
}
}//package
Section 9
//dintro (dintro)
package {
import flash.media.*;
public dynamic class dintro extends Sound {
}
}//package
Section 10
//menusong (menusong)
package {
import flash.media.*;
public dynamic class menusong extends Sound {
}
}//package
Section 11
//NewgroundsAPI (NewgroundsAPI)
package {
import flash.events.*;
import flash.display.*;
import flash.net.*;
import flash.text.*;
public class NewgroundsAPI {
public static const ADS_APPROVED:Number = 3;
public static const bridge:Sprite = new Sprite();
private static const STAT_NEW_VERSION:Number = 4;
private static const STAT_AUTHOR_SITE:Number = 2;
private static const GATEWAY_URL:String = "http://www.ngads.com/gateway.php";
private static const NEWGROUNDS_URL:String = "http://www.newgrounds.com";
private static const STAT_CUSTOM_STATS:Number = 50;
private static const STAT_MOVIE_VIEWS:Number = 1;
private static const STAT_NEWGROUNDS:Number = 3;
public static const NEW_VERSION:Number = 2;
public static const DENY_HOST:Number = 1;
private static var tracker_id:Number;
private static var movie_options:Object = new Object();
private static var connected:Boolean;
private static var custom_events:Object = new Object();
private static var host:String;
private static var linked:Boolean;
private static var events:Object = new Object();
private static var debug:Boolean;
private static var version:String;
private static var custom_links:Object = new Object();
public static function getNewVersionURL(){
return (((((((GATEWAY_URL + "?&id=") + tracker_id) + "&host=") + escape(host)) + "&stat=") + STAT_NEW_VERSION));
}
private static function ReadGatewayData(_arg1:Object){
var _local2:*;
var _local3:String;
var _local4:*;
var _local5:URLLoader;
for (_local2 in _arg1) {
_arg1[_local2] = unescape(_arg1[_local2]);
movie_options[_local2] = _arg1[_local2];
};
if (_arg1["settings_loaded"]){
SendMessage("You have successfully connected to the Newgrounds API gateway!");
SendMessage((("Movie Identified as '" + movie_options["movie_name"]) + "'"));
if (movie_options["message"]){
SendMessage(movie_options["message"]);
};
if (movie_options["ad_url"]){
SendMessage("Your movie has been approved to run Flash Ads");
if (events[ADS_APPROVED]){
var _local6 = events;
_local6[ADS_APPROVED](movie_options["ad_url"]);
} else {
onAdsApproved(movie_options["ad_url"]);
};
};
if (((movie_options["movie_version"]) && (!((String(movie_options["movie_version"]) == String(version)))))){
SendMessage("WARNING: The movie version configured in your API settings does not match this movie's version!");
if (events[NEW_VERSION]){
_local6 = events;
_local6[NEW_VERSION]({version:movie_options["movie_version"], real_url:getMovieURL(), redirect_url:getNewVersionURL()});
} else {
onNewVersionAvailable(movie_options["movie_version"], getMovieURL(), getNewVersionURL());
};
};
if (movie_options["deny_host"]){
SendMessage("You have blocked 'localHost' in your API settings.");
SendMessage("If you wish to test your movie you will need to remove this block.");
if (events[DENY_HOST]){
_local6 = events;
_local6[DENY_HOST]({host:host, real_url:getMovieURL(), redirect_url:getNewVersionURL()});
} else {
onDenyHost(host, getMovieURL(), getNewVersionURL());
};
};
if (movie_options["request_portal_url"]){
_local3 = bridge.root.loaderInfo.url;
_local4 = ((((GATEWAY_URL + "?&id=") + tracker_id) + "&portal_url=") + escape(_local3));
_local5 = new URLLoader(new URLRequest(_local4));
};
if (events[69]){
_local6 = events;
_local6[69]();
};
} else {
if (!movie_options["settings_loaded"]){
SendError("Could not establish connection to the API gateway.");
};
};
}
public static function setMovieVersion(_arg1){
if (!_arg1){
SendError("Missing required 'version' in NewgroundsAPI.setMovieVersion(version:String)");
} else {
version = String(_arg1);
};
}
public static function loadCustomLink(_arg1:String){
if (!_arg1){
SendError("Missing required 'link_name' parameter in NewgroundsAPI.loadCustomLink(link_name:String)");
} else {
if (!custom_links[_arg1]){
SendError(("Attempted to open undefined custom link: " + _arg1));
} else {
SendLink(custom_links[_arg1]);
};
};
}
public static function addCustomLink(_arg1:Number, _arg2:String){
if (!_arg1){
SendError("Missing required 'id' parameter in NewgroundsAPI.AddCustomLink(id:Number, link_name:String)");
} else {
if (!_arg2){
SendError("Missing required 'link_name' parameter in NewgroundsAPI.AddCustomLink(id:Number, link_name:String)");
} else {
custom_links[_arg2] = (STAT_CUSTOM_STATS + _arg1);
SendMessage(((("Created custom link " + _arg1) + ": ") + _arg2));
};
};
}
public static function getMovieURL(){
if (movie_options["movie_url"]){
return (movie_options["movie_url"]);
};
return ("Newgrounds.com");
}
public static function debugMode(){
debug = true;
}
public static function getAdURL(){
return (movie_options["ad_url"]);
}
private static function SendStat(_arg1:Number, _arg2:Boolean, _arg3=null){
var target_url:*;
var XML_Loaded:Function;
var x:*;
var request:URLRequest;
var gateway_loader:URLLoader;
var stat_id = _arg1;
var open_in_browser = _arg2;
var extra = _arg3;
if (!tracker_id){
SendError("You must call NewgroundsAPI.connectMovie() with a valid movie id before using API features!");
} else {
XML_Loaded = function (_arg1:Event){
var _local2:XML;
var _local3:Object;
var _local4:XMLList;
var _local5:XML;
var _local6:*;
var _local7:*;
XML.ignoreWhitespace = true;
_local2 = XML(_arg1.target.data);
_local3 = new Object();
_local4 = _local2.children();
for each (_local5 in _local4) {
_local6 = _local5.localName();
_local7 = _local5.attribute("value");
if (_local7 == Number(_local7)){
_local7 = Number(_local7);
};
_local3[_local6] = _local7;
};
ReadGatewayData(_local3);
};
target_url = (((((((GATEWAY_URL + "?&id=") + tracker_id) + "&host=") + escape(host)) + "&stat=") + stat_id) + addSeed());
if (extra){
for (x in extra) {
target_url = (target_url + ((("&" + escape(x)) + "=") + escape(extra[x])));
};
};
if (debug){
target_url = (target_url + "&debug=1");
};
if (open_in_browser){
request = new URLRequest((target_url + addSeed()));
navigateToURL(request, "_blank");
} else {
gateway_loader = new URLLoader(new URLRequest((target_url + addSeed())));
gateway_loader.addEventListener(Event.COMPLETE, XML_Loaded);
};
};
}
public static function onAdsApproved(_arg1:String){
}
public static function loadMySite(_arg1:Event=null){
SendLink(STAT_AUTHOR_SITE);
}
private static function SendMessage(_arg1:String){
trace(("[NEWGROUNDS API] :: " + _arg1));
}
public static function linkAPI(_arg1){
_arg1.addChild(bridge);
linked = true;
}
public static function loadNewgrounds(_arg1:Event=null, _arg2:String=null){
var _local3:URLRequest;
var _local4:*;
if (!tracker_id){
_local3 = new URLRequest(((NEWGROUNDS_URL + "/") + _arg2));
navigateToURL(_local3, "_blank");
} else {
_local4 = null;
if (_arg2){
_local4 = new Object();
_local4.page = _arg2;
};
SendLink(STAT_NEWGROUNDS, _local4);
};
}
private static function SendLink(_arg1, _arg2=null){
SendStat(_arg1, true, _arg2);
}
public static function logCustomEvent(_arg1:String){
if (!_arg1){
SendError("Missing required 'event_name' parameter in NewgroundsAPI.logCustomEvent(event_name:String)");
} else {
if (!custom_events[_arg1]){
SendError(("Attempted to log undefined custom event: " + _arg1));
} else {
SendEvent(custom_events[_arg1]);
};
};
}
private static function SendError(_arg1:String){
trace(("[NEWGROUNDS API ERROR] :: " + _arg1));
}
public static function addCustomEvent(_arg1:Number, _arg2:String){
if (!_arg1){
SendError("Missing required 'id' parameter in NewgroundsAPI.AddCustomEvent(id:Number, event_name:String)");
} else {
if (!_arg2){
SendError("Missing required 'event_name' parameter in NewgroundsAPI.AddCustomEvent(id:Number, event_name:String)");
} else {
custom_events[_arg2] = (STAT_CUSTOM_STATS + _arg1);
SendMessage(("Created custom event: " + _arg2));
};
};
}
private static function addSeed(){
return (("&seed=" + Math.random()));
}
public static function addEventListener(_arg1:Number, _arg2:Function){
events[_arg1] = _arg2;
}
private static function SendEvent(_arg1){
SendStat(_arg1, false);
}
public static function onNewVersionAvailable(_arg1:String, _arg2:String, _arg3:String){
var sw:*;
var sh:*;
var tw:*;
var th:*;
var mg:*;
var _root:*;
var overlay:MovieClip;
var overlay_x:*;
var overlay_y:*;
var close_x:*;
var blankarea:TextField;
var header:TextField;
var header_format:TextFormat;
var msgtext:TextField;
var msgtext_format:TextFormat;
var msgtext_link:TextFormat;
var version = _arg1;
var movie_url = _arg2;
var redirect_url = _arg3;
sw = bridge.stage.stageWidth;
sh = bridge.stage.stageHeight;
tw = 350;
th = 160;
mg = 20;
_root = bridge.root;
overlay = new MovieClip();
overlay.graphics.beginFill(0, 0.6);
overlay.graphics.lineStyle(0, 0);
overlay.graphics.drawRect(0, 0, sw, sh);
overlay.graphics.endFill();
overlay_x = Math.round(((sw - tw) / 2));
overlay_y = Math.round(((sh - th) / 2));
overlay.graphics.beginFill(102);
overlay.graphics.lineStyle(10, 0);
overlay.graphics.drawRect((overlay_x - mg), (overlay_y - mg), (tw + mg), (th + mg));
overlay.graphics.endFill();
overlay.close = function (_arg1:Event){
_root.removeChild(overlay);
};
close_x = new MovieClip();
close_x.graphics.beginFill(0, 0.1);
close_x.graphics.lineStyle(3, 22015);
close_x.graphics.drawRect(0, 0, 16, 16);
close_x.graphics.endFill();
close_x.graphics.moveTo(4, 4);
close_x.graphics.lineTo(13, 13);
close_x.graphics.moveTo(13, 4);
close_x.graphics.lineTo(4, 13);
close_x.x = ((overlay_x + tw) - 26);
close_x.y = (overlay_y - 10);
close_x.addEventListener(MouseEvent.CLICK, overlay.close);
blankarea = new TextField();
blankarea.x = (overlay_x - mg);
blankarea.y = (overlay_y - mg);
blankarea.width = (tw + mg);
blankarea.height = (th + mg);
blankarea.selectable = false;
header = new TextField();
header.width = tw;
header.x = overlay_x;
header.y = overlay_y;
header.height = 100;
header.selectable = false;
header_format = new TextFormat();
header_format.font = "Arial Black";
header_format.color = 0xFFFFFF;
header_format.size = 20;
header.defaultTextFormat = header_format;
header.text = "New Version Available!";
msgtext = new TextField();
msgtext.x = overlay_x;
msgtext.y = (overlay_y + 70);
msgtext.width = tw;
msgtext.height = 60;
msgtext.selectable = false;
msgtext_format = new TextFormat();
msgtext_format.font = "Arial";
msgtext_format.color = 0xFFFFFF;
msgtext_format.size = 12;
msgtext_format.bold = true;
msgtext_link = new TextFormat();
msgtext_link.font = "Arial";
msgtext_link.color = 0xFFFF00;
msgtext_link.size = 12;
msgtext_link.bold = true;
msgtext_link.url = redirect_url;
msgtext_link.target = "_blank";
if (version){
version = ("Version " + version);
} else {
version = "A new version";
};
msgtext.defaultTextFormat = msgtext_format;
msgtext.appendText((version + " is now available"));
if (movie_url){
msgtext.appendText(" at:\n");
msgtext.defaultTextFormat = msgtext_link;
msgtext.appendText(movie_url);
} else {
msgtext.appendText("!");
};
_root.addChild(overlay);
overlay.addChild(blankarea);
overlay.addChild(header);
overlay.addChild(msgtext);
overlay.addChild(close_x);
}
public static function onDenyHost(_arg1:String, _arg2:String, _arg3:String){
var _local4:*;
var _local5:*;
var _local6:*;
var _local7:*;
var _local8:*;
var _local9:MovieClip;
var _local10:TextField;
var _local11:TextField;
var _local12:TextFormat;
var _local13:TextField;
var _local14:TextFormat;
var _local15:TextFormat;
_local4 = bridge.stage.stageWidth;
_local5 = bridge.stage.stageHeight;
_local6 = 350;
_local7 = 160;
_local8 = bridge.root;
_local9 = new MovieClip();
_local9.graphics.beginFill(0x660000);
_local9.graphics.lineStyle(20, 0);
_local9.graphics.drawRect(0, 0, _local4, _local5);
_local9.graphics.endFill();
_local10 = new TextField();
_local10.x = 0;
_local10.y = 0;
_local10.width = _local4;
_local10.height = _local5;
_local10.selectable = false;
_local11 = new TextField();
_local11.x = Math.round(((_local4 - _local6) / 2));
_local11.y = Math.round(((_local5 - _local7) / 2.5));
_local11.width = _local6;
_local11.height = 100;
_local11.selectable = false;
_local12 = new TextFormat();
_local12.font = "Arial Black";
_local12.color = 0xFF0000;
_local12.size = 38;
_local11.defaultTextFormat = _local12;
_local11.text = "ERROR!";
_local13 = new TextField();
_local13.x = Math.round(((_local4 - _local6) / 2));
_local13.y = (Math.round(((_local5 - _local7) / 2.5)) + 80);
_local13.width = _local6;
_local13.height = 80;
_local13.selectable = false;
_local14 = new TextFormat();
_local14.font = "Arial";
_local14.color = 0xFFFFFF;
_local14.size = 12;
_local14.bold = true;
_local15 = new TextFormat();
_local15.font = "Arial";
_local15.color = 0xFFFF00;
_local15.size = 12;
_local15.bold = true;
_local15.url = _arg3;
_local15.target = "_blank";
_local13.defaultTextFormat = _local14;
_local13.appendText((("This movie has not been approved for use on " + _arg1) + "\n"));
_local13.appendText("For an approved copy, please visit:\n");
_local13.defaultTextFormat = _local15;
_local13.appendText(_arg2);
_local8.addChild(_local9);
_local9.addChild(_local10);
_local9.addChild(_local11);
_local9.addChild(_local13);
}
public static function connectMovie(_arg1:Number){
var _local2:String;
var _local3:*;
if (!_arg1){
SendError("Missing required 'id' parameter in NewgroundsAPI.connectMovie(id:Number)");
} else {
if (!linked){
SendError("Attempted to call MewgroundsAPI.connectMovie() without first calling NewgroundsAPI.linkAPI(this)");
} else {
if (!tracker_id){
SendMessage("Connecting to API gateway...");
tracker_id = _arg1;
_local2 = bridge.root.loaderInfo.url;
host = _local2.split("/")[2].toLowerCase();
if (host.length < 1){
host = "localhost";
};
_local3 = new Object();
SendEvent(STAT_MOVIE_VIEWS);
};
};
};
}
public static function isInstalled(){
return (true);
}
}
}//package
Section 12
//shaloop (shaloop)
package {
import flash.display.*;
public dynamic class shaloop extends MovieClip {
}
}//package
Section 13
//thing (thing)
package {
import flash.display.*;
public dynamic class thing extends MovieClip {
}
}//package
Section 14
//tile (tile)
package {
import flash.display.*;
public dynamic class tile extends MovieClip {
public var datile:MovieClip;
}
}//package
Section 15
//tilepiece (tilepiece)
package {
import flash.display.*;
public dynamic class tilepiece extends MovieClip {
}
}//package