Section 1
//cblock (cblock)
package {
import flash.display.*;
public dynamic class cblock extends MovieClip {
public var ydecay:int;
public var exploded:Boolean;
public var img:gblock;
public var xmov:int;
public var xrot:int;
public function cblock(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
exploded = false;
ydecay = 0;
xmov = 0;
xrot = 0;
}
}
}//package
Section 2
//cbomb (cbomb)
package {
import flash.display.*;
public dynamic class cbomb extends MovieClip {
public var img:gbomb;
public var setdown:Boolean;
public var dir:int;
public var mtick:int;
public var frame:int;
public var boomtick:int;
public var blowframe:int;
public var atick:int;
public function cbomb(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
frame = 0;
setdown = false;
atick = 0;
mtick = 0;
boomtick = 0;
blowframe = 0;
}
}
}//package
Section 3
//cchar (cchar)
package {
import flash.display.*;
public dynamic class cchar extends MovieClip {
public var bd:gcharbd;
public var char:gchar;
}
}//package
Section 4
//cclown (cclown)
package {
import flash.display.*;
public dynamic class cclown extends MovieClip {
public var img:gclown;
public var anitick:int;
public var movetick:int;
public function cclown(){
addFrameScript(0, frame1);
}
function frame1(){
movetick = 0;
anitick = 0;
}
}
}//package
Section 5
//ccontinuebutton (ccontinuebutton)
package {
import flash.display.*;
public dynamic class ccontinuebutton extends MovieClip {
public var bd:gcharbd;
}
}//package
Section 6
//ccredits (ccredits)
package {
import flash.events.*;
import flash.display.*;
public dynamic class ccredits extends MovieClip {
public var gb:cghostbutton;
public function ccredits(){
addFrameScript(0, frame1);
}
public function bmc(_arg1:MouseEvent){
tetrisfools(root).titleprep();
}
function frame1(){
gb.buttonMode = true;
gb.addEventListener(MouseEvent.CLICK, bmc);
}
}
}//package
Section 7
//cdeadbar (cdeadbar)
package {
import flash.display.*;
public dynamic class cdeadbar extends MovieClip {
public function cdeadbar(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 8
//cdropobjects (cdropobjects)
package {
import flash.display.*;
public dynamic class cdropobjects extends MovieClip {
public var img:gdropobjects;
}
}//package
Section 9
//cending (cending)
package {
import flash.events.*;
import flash.display.*;
public dynamic class cending extends MovieClip {
public var skull:cskull;
public var shark:cshark;
public var gbhut:cghostbutton;
public var rb:creplaybutton;
public var qb:cquitbutton;
public var tetris:closer;
public var clown:cclown;
public function cending(){
addFrameScript(0, frame1);
}
public function qbmov(_arg1:MouseEvent){
if (!tetrisfools(root).skullmode){
qb.bd.gotoAndStop(2);
};
}
public function qbmc(_arg1:MouseEvent){
if (!tetrisfools(root).skullmode){
tetrisfools(root).playsound("sfx", "menuselect");
tetrisfools(root).creditsprep();
};
}
public function gbc(_arg1:MouseEvent){
if (!tetrisfools(root).skullmode){
tetrisfools(root).endgameskull();
};
}
public function bmou(_arg1:MouseEvent){
rb.bd.gotoAndStop(1);
}
function frame1(){
rb.buttonMode = true;
rb.addEventListener(MouseEvent.MOUSE_OVER, bmov);
rb.addEventListener(MouseEvent.MOUSE_OUT, bmou);
rb.addEventListener(MouseEvent.CLICK, bmc);
qb.buttonMode = true;
qb.addEventListener(MouseEvent.MOUSE_OVER, qbmov);
qb.addEventListener(MouseEvent.MOUSE_OUT, qbmou);
qb.addEventListener(MouseEvent.CLICK, qbmc);
skull.visible = false;
gbhut.buttonMode = true;
gbhut.addEventListener(MouseEvent.CLICK, gbc);
shark.visible = false;
clown.visible = false;
tetris.visible = false;
}
public function qbmou(_arg1:MouseEvent){
qb.bd.gotoAndStop(1);
}
public function bmov(_arg1:MouseEvent){
if (!tetrisfools(root).skullmode){
rb.bd.gotoAndStop(2);
};
}
public function bmc(_arg1:MouseEvent){
if (!tetrisfools(root).skullmode){
tetrisfools(root).playsound("sfx", "menuselect");
tetrisfools(root).optionsprep();
};
}
}
}//package
Section 10
//cerror (cerror)
package {
import flash.display.*;
public dynamic class cerror extends MovieClip {
}
}//package
Section 11
//cfirework (cfirework)
package {
import flash.display.*;
public dynamic class cfirework extends MovieClip {
}
}//package
Section 12
//cghostbutton (cghostbutton)
package {
import flash.display.*;
public dynamic class cghostbutton extends MovieClip {
}
}//package
Section 13
//cloader (cloader)
package {
import flash.display.*;
public dynamic class cloader extends MovieClip {
public function cloader(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 14
//closer (closer)
package {
import flash.events.*;
import flash.display.*;
import flash.media.*;
import flash.utils.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.geom.*;
import flash.net.*;
import flash.printing.*;
import flash.profiler.*;
import flash.sampler.*;
import flash.system.*;
import flash.text.*;
import flash.ui.*;
import flash.xml.*;
public dynamic class closer extends MovieClip {
public var bd:gtetborder;
public var loserarray;
public var i:int;
public var frame:int;
public var movetick:int;
public var od:gcharbd;
public var anitick:int;
public var to;
public function closer(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
loserarray = new Array();
i = 0;
anitick = 0;
movetick = 0;
frame = 0;
bd.enabled = false;
od.enabled = false;
i = 0;
while (i < numChildren) {
to = getChildAt(i);
if (to.enabled){
loserarray.push(to);
};
i++;
};
od.gotoAndStop(4);
}
}
}//package
Section 15
//cnextblocks (cnextblocks)
package {
import flash.display.*;
public dynamic class cnextblocks extends MovieClip {
public function cnextblocks(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 16
//comegablocks (comegablocks)
package {
import flash.display.*;
public dynamic class comegablocks extends MovieClip {
public var img:gbomb;
public var gb1:cghostbutton;
public var gb2:cghostbutton;
public var gb3:cghostbutton;
public var gb4:cghostbutton;
public function comegablocks(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 17
//coptions (coptions)
package {
import flash.events.*;
import flash.display.*;
import flash.media.*;
import flash.utils.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.geom.*;
import flash.net.*;
import flash.printing.*;
import flash.profiler.*;
import flash.sampler.*;
import flash.system.*;
import flash.text.*;
import flash.ui.*;
import flash.xml.*;
public dynamic class coptions extends MovieClip {
public var gbm3:cghostbutton;
public var gbm2:cghostbutton;
public var gbm4:cghostbutton;
public var gbt1:cghostbutton;
public var gbt2:cghostbutton;
public var gbarray:Array;
public var smusic:cselectmusic;
public var berror:cerror;
public var i:int;
public var stype:cselecttype;
public var gbs:cghostbutton;
public var gbm1:cghostbutton;
public function coptions(){
addFrameScript(0, frame1);
}
public function gbclick(_arg1:MouseEvent){
if (_arg1.currentTarget.name == "gbt1"){
stype.x = (gbt1.x + 13);
tetrisfools(root).playsound("sfx", "menutick");
} else {
if (_arg1.currentTarget.name == "gbt2"){
stype.x = (gbt2.x + 13);
tetrisfools(root).playsound("sfx", "menutick");
} else {
if (_arg1.currentTarget.name == "gbm1"){
smusic.y = (_arg1.currentTarget.y + 7);
if (tetrisfools(root).selmnum != 1){
tetrisfools(root).setmusic(1);
};
tetrisfools(root).playsound("sfx", "menutick");
} else {
if (_arg1.currentTarget.name == "gbm2"){
if (tetrisfools(root).selmnum != 2){
tetrisfools(root).setmusic(2);
};
smusic.y = (_arg1.currentTarget.y + 7);
tetrisfools(root).playsound("sfx", "menutick");
} else {
if (_arg1.currentTarget.name == "gbm3"){
if (tetrisfools(root).selmnum != 3){
tetrisfools(root).setmusic(3);
};
smusic.y = (_arg1.currentTarget.y + 7);
tetrisfools(root).playsound("sfx", "menutick");
} else {
if (_arg1.currentTarget.name == "gbm4"){
tetrisfools(root).optionerror = true;
tetrisfools(root).playsound("sfx", "error");
} else {
if (_arg1.currentTarget.name == "gbs"){
if (stype.x == 125){
tetrisfools(root).playsound("sfx", "menuselect");
tetrisfools(root).playfieldprep();
} else {
tetrisfools(root).starfieldprep();
};
};
};
};
};
};
};
};
}
function frame1(){
stype.gotoAndStop(1);
smusic.gotoAndStop(1);
berror.visible = false;
gbarray = new Array();
i = 0;
gbarray.push(gbt1);
gbarray.push(gbt2);
gbarray.push(gbm1);
gbarray.push(gbm2);
gbarray.push(gbm3);
gbarray.push(gbm4);
gbarray.push(gbs);
i = 0;
while (i < gbarray.length) {
gbarray[i].buttonMode = true;
gbarray[i].addEventListener(MouseEvent.CLICK, gbclick);
i++;
};
}
}
}//package
Section 18
//cplayfield (cplayfield)
package {
import flash.events.*;
import flash.display.*;
import flash.media.*;
import flash.utils.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.geom.*;
import flash.net.*;
import flash.printing.*;
import flash.profiler.*;
import flash.sampler.*;
import flash.system.*;
import flash.text.*;
import flash.ui.*;
import flash.xml.*;
public dynamic class cplayfield extends MovieClip {
public var chrlines3:cchar;
public var chrstat61:cchar;
public var chrlines2:cchar;
public var chrlevel1:cchar;
public var chrstat71:cchar;
public var chrstat72:cchar;
public var db10:cdeadbar;
public var db11:cdeadbar;
public var db12:cdeadbar;
public var db13:cdeadbar;
public var db14:cdeadbar;
public var db15:cdeadbar;
public var db16:cdeadbar;
public var chrstat73:cchar;
public var db18:cdeadbar;
public var db19:cdeadbar;
public var omegablocks:comegablocks;
public var chrlevel2:cchar;
public var db17:cdeadbar;
public var nextblocks:cnextblocks;
public var db20:cdeadbar;
public var spaz:gcharbd;
public var chrstat11:cchar;
public var chrstat12:cchar;
public var chrstat13:cchar;
public var i:int;
public var j:int;
public var db1:cdeadbar;
public var db2:cdeadbar;
public var db3:cdeadbar;
public var db4:cdeadbar;
public var db5:cdeadbar;
public var db7:cdeadbar;
public var db8:cdeadbar;
public var db9:cdeadbar;
public var db6:cdeadbar;
public var chrstat21:cchar;
public var chrstat22:cchar;
public var chrstat23:cchar;
public var to;
public var chrstat31:cchar;
public var chrstat33:cchar;
public var chrstat32:cchar;
public var statpic:cstats;
public var chrstat41:cchar;
public var chrstat42:cchar;
public var chrstat43:cchar;
public var chrscore1:cchar;
public var chrscore2:cchar;
public var chrscore3:cchar;
public var chrscore4:cchar;
public var chrscore5:cchar;
public var chrscore6:cchar;
public var chrstat51:cchar;
public var chrstat52:cchar;
public var chrstat53:cchar;
public var bb1:cblock;
public var bb3:cblock;
public var bb2:cblock;
public var chrstat62:cchar;
public var chrstat63:cchar;
public var chrlines1:cchar;
public function cplayfield(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
bb1.visible = false;
bb2.visible = false;
bb3.visible = false;
omegablocks.visible = false;
i = 0;
j = 0;
i = 1;
while (i <= 20) {
to = getChildByName(("db" + i));
to.visible = false;
i++;
};
i = 1;
while (i <= 7) {
j = 1;
while (j <= 3) {
to = getChildByName(((("chrstat" + i) + "") + j));
to.bd.gotoAndStop(2);
j++;
};
i++;
};
spaz.alpha = 0.5;
spaz.visible = false;
spaz.width = 520;
spaz.height = 456;
}
}
}//package
Section 19
//cpreface (cpreface)
package {
import flash.events.*;
import flash.display.*;
public dynamic class cpreface extends MovieClip {
public var gb:cghostbutton;
public function cpreface(){
addFrameScript(0, frame1);
}
public function gbmc(_arg1:MouseEvent){
tetrisfools(root).optionsprep();
}
function frame1(){
stop();
gb.buttonMode = true;
gb.addEventListener(MouseEvent.CLICK, gbmc);
}
}
}//package
Section 20
//cquitbutton (cquitbutton)
package {
import flash.display.*;
public dynamic class cquitbutton extends MovieClip {
public var bd:gcharbd;
}
}//package
Section 21
//creplaybutton (creplaybutton)
package {
import flash.display.*;
public dynamic class creplaybutton extends MovieClip {
public var bd:gcharbd;
public function creplaybutton(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 22
//crflame (crflame)
package {
import flash.display.*;
public dynamic class crflame extends MovieClip {
public function crflame(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 23
//crship (crship)
package {
import flash.display.*;
public dynamic class crship extends MovieClip {
public function crship(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 24
//cselectmusic (cselectmusic)
package {
import flash.display.*;
public dynamic class cselectmusic extends MovieClip {
}
}//package
Section 25
//cselecttype (cselecttype)
package {
import flash.display.*;
public dynamic class cselecttype extends MovieClip {
}
}//package
Section 26
//cshark (cshark)
package {
import flash.display.*;
public dynamic class cshark extends MovieClip {
public var img:gshark;
public var anitick:int;
public var movetick:int;
public function cshark(){
addFrameScript(0, frame1);
}
function frame1(){
movetick = 0;
anitick = 0;
}
}
}//package
Section 27
//cskull (cskull)
package {
import flash.display.*;
public dynamic class cskull extends MovieClip {
public var img:gskull;
}
}//package
Section 28
//cstarfield (cstarfield)
package {
import flash.display.*;
public dynamic class cstarfield extends MovieClip {
public var flame:crflame;
public var ship:crship;
public var bg1:gstarfield;
public var bg2:gstarfield;
public function cstarfield(){
addFrameScript(0, frame1);
}
function frame1(){
ship.visible = false;
flame.visible = false;
}
}
}//package
Section 29
//cstats (cstats)
package {
import flash.display.*;
public dynamic class cstats extends MovieClip {
}
}//package
Section 30
//ctitle (ctitle)
package {
import flash.events.*;
import flash.display.*;
public dynamic class ctitle extends MovieClip {
public var fw:cfirework;
public var startbutton:ctxtstart;
public function ctitle(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
startbutton.addEventListener(MouseEvent.MOUSE_OVER, smover);
startbutton.addEventListener(MouseEvent.MOUSE_OUT, smout);
startbutton.addEventListener(MouseEvent.CLICK, smclick);
startbutton.buttonMode = true;
startbutton.gotoAndStop(1);
fw.visible = false;
fw.addEventListener(MouseEvent.CLICK, fwc);
}
public function smout(_arg1:MouseEvent){
startbutton.gotoAndStop(1);
}
public function smclick(_arg1:MouseEvent){
tetrisfools(root).playsound("sfx", "menuselect");
tetrisfools(root).prefaceprep();
}
public function fwc(_arg1:MouseEvent){
if (fw.visible){
tetrisfools(root).fireworked = true;
tetrisfools(root).playsound("sfx", "bomb");
};
}
public function smover(_arg1:MouseEvent){
startbutton.gotoAndStop(2);
}
}
}//package
Section 31
//ctxtstart (ctxtstart)
package {
import flash.display.*;
public dynamic class ctxtstart extends MovieClip {
}
}//package
Section 32
//gblock (gblock)
package {
import flash.display.*;
public dynamic class gblock extends MovieClip {
public function gblock(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 33
//gbomb (gbomb)
package {
import flash.display.*;
public dynamic class gbomb extends MovieClip {
public function gbomb(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 34
//gchar (gchar)
package {
import flash.display.*;
public dynamic class gchar extends MovieClip {
public function gchar(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 35
//gcharbd (gcharbd)
package {
import flash.display.*;
public dynamic class gcharbd extends MovieClip {
public function gcharbd(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 36
//gclown (gclown)
package {
import flash.display.*;
public dynamic class gclown extends MovieClip {
public function gclown(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 37
//gdropobjects (gdropobjects)
package {
import flash.display.*;
public dynamic class gdropobjects extends MovieClip {
public var gb1:cghostbutton;
public var gb2:cghostbutton;
public var gb3:cghostbutton;
public var gb4:cghostbutton;
public function gdropobjects(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 38
//gshark (gshark)
package {
import flash.display.*;
public dynamic class gshark extends MovieClip {
public function gshark(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 39
//gskull (gskull)
package {
import flash.display.*;
public dynamic class gskull extends MovieClip {
public function gskull(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 40
//gstarfield (gstarfield)
package {
import flash.display.*;
public dynamic class gstarfield extends MovieClip {
}
}//package
Section 41
//gtetborder (gtetborder)
package {
import flash.display.*;
public dynamic class gtetborder extends MovieClip {
}
}//package
Section 42
//mgameover (mgameover)
package {
import flash.media.*;
public dynamic class mgameover extends Sound {
}
}//package
Section 43
//mpolka (mpolka)
package {
import flash.media.*;
public dynamic class mpolka extends Sound {
}
}//package
Section 44
//mpolkafast (mpolkafast)
package {
import flash.media.*;
public dynamic class mpolkafast extends Sound {
}
}//package
Section 45
//mrtypemusdeath (mrtypemusdeath)
package {
import flash.media.*;
public dynamic class mrtypemusdeath extends Sound {
}
}//package
Section 46
//mrtypemusintro (mrtypemusintro)
package {
import flash.media.*;
public dynamic class mrtypemusintro extends Sound {
}
}//package
Section 47
//mrtypemusstage (mrtypemusstage)
package {
import flash.media.*;
public dynamic class mrtypemusstage extends Sound {
}
}//package
Section 48
//msharksfin (msharksfin)
package {
import flash.media.*;
public dynamic class msharksfin extends Sound {
}
}//package
Section 49
//msharksfinfast (msharksfinfast)
package {
import flash.media.*;
public dynamic class msharksfinfast extends Sound {
}
}//package
Section 50
//mtetris (mtetris)
package {
import flash.media.*;
public dynamic class mtetris extends Sound {
}
}//package
Section 51
//mtetrisfast (mtetrisfast)
package {
import flash.media.*;
public dynamic class mtetrisfast extends Sound {
}
}//package
Section 52
//mtitle (mtitle)
package {
import flash.media.*;
public dynamic class mtitle extends Sound {
}
}//package
Section 53
//sbomb (sbomb)
package {
import flash.media.*;
public dynamic class sbomb extends Sound {
}
}//package
Section 54
//serror (serror)
package {
import flash.media.*;
public dynamic class serror extends Sound {
}
}//package
Section 55
//slaugh (slaugh)
package {
import flash.media.*;
public dynamic class slaugh extends Sound {
}
}//package
Section 56
//smenuselect (smenuselect)
package {
import flash.media.*;
public dynamic class smenuselect extends Sound {
}
}//package
Section 57
//smenutick (smenutick)
package {
import flash.media.*;
public dynamic class smenutick extends Sound {
}
}//package
Section 58
//srtypedeath (srtypedeath)
package {
import flash.media.*;
public dynamic class srtypedeath extends Sound {
}
}//package
Section 59
//srtypeshot (srtypeshot)
package {
import flash.media.*;
public dynamic class srtypeshot extends Sound {
}
}//package
Section 60
//stetrisblockset (stetrisblockset)
package {
import flash.media.*;
public dynamic class stetrisblockset extends Sound {
}
}//package
Section 61
//stetrisdeath (stetrisdeath)
package {
import flash.media.*;
public dynamic class stetrisdeath extends Sound {
}
}//package
Section 62
//stetrislineclear (stetrislineclear)
package {
import flash.media.*;
public dynamic class stetrislineclear extends Sound {
}
}//package
Section 63
//stetrismove (stetrismove)
package {
import flash.media.*;
public dynamic class stetrismove extends Sound {
}
}//package
Section 64
//stetrisnextlevel (stetrisnextlevel)
package {
import flash.media.*;
public dynamic class stetrisnextlevel extends Sound {
}
}//package
Section 65
//stetrisrotate (stetrisrotate)
package {
import flash.media.*;
public dynamic class stetrisrotate extends Sound {
}
}//package
Section 66
//stetristetris (stetristetris)
package {
import flash.media.*;
public dynamic class stetristetris extends Sound {
}
}//package
Section 67
//tetrisfools (tetrisfools)
package {
import flash.events.*;
import flash.display.*;
import flash.media.*;
import flash.utils.*;
import flash.geom.*;
import flash.net.*;
import flash.system.*;
import flash.text.*;
import flash.ui.*;
public class tetrisfools extends MovieClip {
var deadtick:int;// = 0
var fireworklagtick:int;// = 0
public var selmusic:String;// = "tetris"
var eblockarray:Array;
public var loader:cloader;
var leftmostset:int;// = 0
var gameoverplayed:Boolean;// = false
var hitboxarray:Array;
var music:String;// = ""
var starbgtick:int;// = 0
var skullframe:int;// = 0
var lastmomentstick:int;// = 0
var fireworking:Boolean;// = false
var finaldoomtick:int;// = 0
var skullatick:int;// = 0
var skullmtick:int;// = 0
var starintroframe:int;// = 0
var starleantick:int;// = 0
var starpurgearray:Array;
var gameovertick:int;// = 0
var dead:Boolean;// = false
var errorframe:int;// = 0
var i:int;// = 0
var j:int;// = 0
var k:int;// = 0
var hleft:Boolean;// = false
var disablearray:Array;
var rotalt:int;// = 0
var fireworktick:int;// = 0
var deadarray:Array;
var darray:Array;
var endofdaystick:int;// = 0
var errtick:int;// = 0
var starsongtick:int;// = 0
var disabletick:int;// = 0
public var skullmode:Boolean;// = false
var statarray:Array;
var purgearray:Array;
var score:int;// = 0
var starsetframe:int;// = 0
var soundarray:Array;
var starsetdelay:int;// = 0
var bgcredits:ccredits;
var bgoptions:coptions;
var hright:Boolean;// = false
public var optionerror:Boolean;// = false
var minidig:int;// = 0
var reldown:Boolean;// = true
var reducearray:Array;
var downspeed:int;// = 240
public var allloaded:Boolean;
var disable:Boolean;// = false
var rotcenter:int;// = 0
var finalsolution:Boolean;// = false
var descending:Boolean;// = false
var lines:int;// = 0
var hup:Boolean;// = false
public var starttick:int;
var bggameover:cending;
public var tmr:Timer;
public var fireworked:Boolean;// = false
var starreturntrip:Boolean;// = false
var lastdtick:int;// = 0
var bgtitle:ctitle;
var starintroflametick:int;// = 0
var hdown:Boolean;// = false
var starmovetick:int;// = 0
var bgstarfield:cstarfield;
var lasttick:int;// = 0
var starsetdietick:int;// = 0
public var selmnum:int;// = 1
var starintro:Boolean;// = false
var endgame:Boolean;// = false
var lastsplodetick1:int;// = 0
var lastsplodetick2:int;// = 0
var musicarray:Array;
var starintrosong:Boolean;// = true
var stardeadframe:int;// = 0
var nextblock:int;// = 0
var rots:int;// = 0
var disableframe:int;// = 0
var deadframe:int;// = 0
public var level:int;// = 0
var fireworkframe:int;// = 0
var starshotarray:Array;
var dirholding:int;// = 0
public var fireworkoffset:int;// = 0
var bgpreface:cpreface;
var bgplayfield:cplayfield;
var hspace:Boolean;// = false
var stardead:Boolean;// = false
public var p1:cchar;
public var p2:cchar;
public var p3:cchar;
var starblockarray:Array;
public var currentshape:int;// = 0
var starsetmovetick:int;// = 0
var setblockarray:Array;
var ina:Array;
var gamestate:uint;// = 0
var bgmsoundchannel:SoundChannel;
var starshottick:int;// = 0
var starflameframe:int;// = 0
var spaztick:int;// = 0
var clownup:Boolean;// = true
static const keydown:uint = 40;
static const tetrid7:uint = 4;
static const keyspace:uint = 32;
static const holdingnull:uint = 0;
static const stateloading:uint = 0;
static const statepreface:uint = 6;
static const holdingleft:uint = 37;
static const stategameover:uint = 3;
static const keyup:uint = 38;
static const keyright:uint = 39;
static const holdingup:uint = 38;
static const keyleft:uint = 37;
static const statetitle:uint = 1;
static const statecredits:uint = 7;
static const tetridt:uint = 2;
static const tetrid5:uint = 5;
static const holdingdown:uint = 40;
static const stateoptions:uint = 4;
static const tetrids:uint = 7;
static const tetridl:uint = 6;
static const tetridsquare:uint = 3;
static const statestarfield:uint = 5;
static const holdingright:uint = 39;
static const stateplaying:uint = 2;
static const tetridline:uint = 1;
public function tetrisfools(){
setblockarray = new Array();
darray = new Array();
disablearray = new Array();
deadarray = new Array();
statarray = new Array();
starshotarray = new Array();
starblockarray = new Array();
starpurgearray = new Array();
eblockarray = new Array();
ina = new Array();
reducearray = new Array();
hitboxarray = new Array();
purgearray = new Array();
soundarray = new Array();
musicarray = new Array();
bgmsoundchannel = new SoundChannel();
super();
addFrameScript(0, frame1);
addEventListener(Event.ENTER_FRAME, RENDER);
stage.addEventListener(KeyboardEvent.KEY_DOWN, userkeydown);
stage.addEventListener(KeyboardEvent.KEY_UP, userkeyup);
addEventListener(MouseEvent.CLICK, usermouseclick);
}
function usermouseclick(_arg1:MouseEvent){
}
function starfieldprep(){
devisible();
bgstarfield.bg1.x = 0;
bgstarfield.bg2.x = 640;
bgstarfield.ship.visible = true;
bgstarfield.flame.visible = true;
bgstarfield.ship.gotoAndStop(1);
bgstarfield.ship.x = (0 - bgstarfield.ship.width);
bgstarfield.flame.x = (bgstarfield.ship.x - bgstarfield.flame.width);
bgstarfield.ship.y = 213;
bgstarfield.flame.y = 213;
starpurgearray = new Array();
starintro = true;
starsetdelay = 1500;
stardead = false;
starsetframe = 0;
starreturntrip = false;
hdown = false;
hup = false;
hleft = false;
hright = false;
hspace = false;
starshotarray = new Array();
starblockarray = new Array();
bgstarfield.visible = true;
reset(bgstarfield);
playsound("mfx", "rtypemusintro");
starsongtick = getTimer();
starintrosong = true;
gamestate = statestarfield;
}
function crafttetrid(){
var _local1:cblock;
var _local3:int;
var _local4:cbomb;
var _local5:cdropobjects;
var _local6:*;
var _local7:String;
darray = new Array();
if (currentshape == 8){
dirholding = holdingnull;
};
rots = 0;
var _local2:int = nextblock;
currentshape = _local2;
divinenext();
updatevalues();
if (_local2 < 8){
var _local8 = statarray;
var _local9 = (_local2 - 1);
var _local10 = (_local8[_local9] + 1);
_local8[_local9] = _local10;
_local3 = 0;
i = 1;
while (i <= 4) {
_local1 = new cblock();
_local1.visible = false;
darray.push(_local1);
addChild(_local1);
i++;
};
switch (_local2){
case 1:
darray[1].x = 16;
darray[2].x = 32;
darray[3].x = 48;
_local3 = 2;
rotcenter = 2;
break;
case 2:
darray[0].y = 16;
darray[1].x = 16;
darray[2].x = 16;
darray[2].y = 16;
darray[3].x = 32;
darray[3].y = 16;
_local3 = 2;
rotcenter = 2;
break;
case 3:
darray[1].x = 16;
darray[2].y = 16;
darray[3].x = 16;
darray[3].y = 16;
_local3 = 2;
break;
case 4:
darray[1].x = 16;
darray[2].x = 32;
darray[3].x = 32;
darray[3].y = 16;
_local3 = 1;
rotcenter = 1;
break;
case 5:
darray[0].x = 16;
darray[1].x = 32;
darray[2].y = 16;
darray[3].x = 16;
darray[3].y = 16;
_local3 = 1;
rotcenter = 1;
break;
case 6:
darray[1].x = 16;
darray[2].x = 32;
darray[3].y = 16;
_local3 = 3;
rotcenter = 1;
break;
case 7:
darray[1].x = 16;
darray[2].x = 16;
darray[2].y = 16;
darray[3].x = 32;
darray[3].y = 16;
_local3 = 3;
rotcenter = 3;
break;
};
if (level == 2){
_local3 = (_local3 + 3);
};
i = 0;
while (i < 4) {
darray[i].img.gotoAndStop(_local3);
darray[i].visible = true;
i++;
};
} else {
if (_local2 == 8){
_local4 = new cbomb();
addChild(_local4);
darray.push(_local4);
} else {
_local5 = new cdropobjects();
_local7 = "";
_local5.img.gotoAndStop((_local2 - 8));
_local5.img.x = (_local5.img.width / 2);
_local5.img.y = (_local5.img.height / 2);
addChild(_local5);
darray.push(_local5);
hitboxarray = new Array();
i = 0;
while (i < _local5.img.numChildren) {
_local6 = _local5.img.getChildAt(i);
i++;
};
};
};
relocatedescent(238, 46, false);
reset(bgplayfield);
i = 0;
while (i < eblockarray.length) {
reset(eblockarray[i]);
i++;
};
descending = true;
if (currentshape == 8){
if (randm(1, 2) == 2){
darray[0].dir = -1;
darray[0].img.scaleX = -1;
} else {
darray[0].dir = 1;
};
};
}
function endgameskull(){
bggameover.skull.scaleX = 1;
bggameover.skull.scaleY = 1;
bggameover.skull.x = 251;
bggameover.skull.y = 210;
bggameover.skull.img.gotoAndStop(1);
bggameover.skull.visible = true;
bggameover.gbhut.visible = false;
bggameover.rb.buttonMode = false;
bggameover.qb.buttonMode = false;
bggameover.skull.img.rotation = 0;
skullframe = 0;
skullmode = true;
}
function userkeyup(_arg1:KeyboardEvent){
if (gamestate == stateplaying){
if (_arg1.keyCode == dirholding){
dirholding = holdingnull;
};
if (_arg1.keyCode == holdingdown){
reldown = true;
};
} else {
if ((((gamestate == statestarfield)) || ((gamestate == stateoptions)))){
switch (_arg1.keyCode){
case keyleft:
hleft = false;
break;
case keyright:
hright = false;
break;
case keyup:
hup = false;
break;
case keydown:
hdown = false;
break;
case keyspace:
hspace = false;
break;
};
};
};
}
function playsound(_arg1:String, _arg2:String){
var _local7:SoundChannel;
var _local3:SoundTransform = new SoundTransform(1, 0);
var _local4:int;
var _local5:int;
var _local6:Number = 0;
if (_arg1 == "mfx"){
if (_arg2 == "rtypemusstage"){
_local5 = 9999;
_local4 = 2;
} else {
if (_arg2 == "rtypemusintro"){
_local4 = 1;
} else {
if (_arg2 == "rtypemusdeath"){
_local4 = 0;
} else {
if (_arg2 == "sharksfin"){
_local5 = 9999;
_local4 = 3;
} else {
if (_arg2 == "sharksfinfast"){
_local5 = 9999;
_local4 = 4;
} else {
if (_arg2 == "polka"){
_local5 = 999;
_local4 = 5;
} else {
if (_arg2 == "polkafast"){
_local5 = 9999;
_local4 = 6;
} else {
if (_arg2 == "tetris"){
_local5 = 9999;
_local4 = 7;
} else {
if (_arg2 == "tetrisfast"){
_local5 = 9999;
_local4 = 8;
} else {
if (_arg2 == "gameover"){
_local4 = 9;
} else {
if (_arg2 == "title"){
_local5 = 9999;
_local4 = 10;
};
};
};
};
};
};
};
};
};
};
};
music = _arg2;
bgmsoundchannel.stop();
bgmsoundchannel = musicarray[_local4].play(_local6, _local5, _local3);
} else {
if (_arg1 == "sfx"){
switch (_arg2){
case "menuselect":
_local4 = 0;
break;
case "menutick":
_local4 = 1;
break;
case "rtypedeath":
_local4 = 2;
break;
case "rtypeshot":
_local4 = 3;
break;
case "tetrisblockset":
_local4 = 4;
break;
case "tetrisdeath":
_local4 = 5;
break;
case "tetrislineclear":
_local4 = 6;
break;
case "tetrismove":
_local4 = 7;
break;
case "tetrisnextlevel":
_local4 = 8;
break;
case "tetrisrotate":
_local4 = 9;
break;
case "tetristetris":
_local4 = 10;
break;
case "bomb":
_local4 = 11;
break;
case "error":
_local4 = 12;
break;
case "laugh":
_local4 = 13;
break;
};
_local7 = soundarray[_local4].play(0, 0, _local3);
};
};
}
function setblocks(){
var _local5:Rectangle;
var _local6:cghostbutton;
var _local1:Array = new Array();
var _local2:Boolean;
var _local3:int;
var _local4 = 382;
disablearray = new Array();
if (currentshape < 9){
i = 0;
while (i < darray.length) {
_local2 = true;
setblockarray.push(darray[i]);
if (darray[i].y < _local4){
_local4 = darray[i].y;
};
j = 0;
while (j < _local1.length) {
if (_local1[j] == darray[i].y){
_local2 = false;
};
j++;
};
if (_local2){
_local1.push(darray[i].y);
};
i++;
};
} else {
purgearray.push(darray[0]);
i = 0;
while (i < hitboxarray.length) {
_local5 = hitboxarray[i].getRect(this);
if (_local5.y < _local4){
_local4 = _local5.y;
};
_local6 = new cghostbutton();
_local6.x = _local5.x;
_local6.y = _local5.y;
_local6.height = _local5.height;
_local6.width = _local5.width;
addChild(_local6);
setblockarray.push(_local6);
i++;
};
};
if (currentshape < 9){
i = 0;
while (i < _local1.length) {
_local3 = 0;
j = 0;
while (j < setblockarray.length) {
if (setblockarray[j].y == _local1[i]){
_local3++;
};
j++;
};
if (_local3 == 10){
disablearray.push(_local1[i]);
};
i++;
};
};
if (disablearray.length > 0){
disablearray.sort();
disabletick = getTimer();
disableframe = 0;
disable = true;
};
musspeedcheck();
if (!disable){
if (_local4 < 78){
deadframe = 0;
deadtick = getTimer();
dead = true;
bgmsoundchannel.stop();
playsound("sfx", "tetrisdeath");
} else {
playsound("sfx", "tetrisblockset");
crafttetrid();
};
} else {
if (disablearray.length < 4){
playsound("sfx", "tetrislineclear");
} else {
playsound("sfx", "tetristetris");
};
};
}
function frame1(){
stop();
tmr = new Timer(0);
starttick = 0;
tmr.addEventListener(TimerEvent.TIMER, loading);
p1.bd.gotoAndStop(3);
p2.bd.gotoAndStop(3);
p3.bd.gotoAndStop(3);
loader.visible = false;
tmr.start();
}
function titleprep(){
devisible();
bgtitle.visible = true;
fireworking = false;
fireworklagtick = getTimer();
bgtitle.fw.visible = false;
bgtitle.startbutton.gotoAndStop(1);
playsound("mfx", "title");
reset(bgtitle);
gamestate = statetitle;
}
function bombrender(){
var _local1:Rectangle;
var _local2:Rectangle;
var _local3:int;
var _local4:int;
downspeed = 30;
dirholding = holdingdown;
if (darray[0].setdown){
if (darray[0].frame == 0){
if ((getTimer() - darray[0].boomtick) >= 1500){
darray[0].frame = 1;
darray[0].boomtick = 60;
};
if ((getTimer() - darray[0].mtick) >= 90){
darray[0].img.scaleX = darray[0].dir;
relocatedescent((8 * darray[0].dir), 0, true);
darray[0].mtick = getTimer();
};
if ((getTimer() - darray[0].atick) >= 180){
switch (darray[0].img.currentFrame){
case 1:
darray[0].img.gotoAndStop(2);
darray[0].blowframe = 3;
break;
case 2:
darray[0].img.gotoAndStop(1);
darray[0].blowframe = 0;
break;
};
darray[0].atick = getTimer();
};
} else {
if ((getTimer() - darray[0].atick) >= darray[0].boomtick){
switch (darray[0].frame){
case 1:
case 3:
case 5:
case 7:
case 9:
case 11:
case 13:
darray[0].img.gotoAndStop((3 + darray[0].blowframe));
break;
case 2:
case 4:
case 6:
case 8:
case 10:
case 12:
case 14:
darray[0].img.gotoAndStop((4 + darray[0].blowframe));
break;
case 15:
playsound("sfx", "bomb");
reset(darray[0]);
darray[0].img.scaleX = 1;
darray[0].img.gotoAndStop(5);
darray[0].boomtick = 20;
_local2 = new Rectangle((darray[0].x - 32), (darray[0].y - 32), 96, 96);
_local3 = 0;
_local4 = 0;
i = (setblockarray.length - 1);
while (i >= 0) {
if (setblockarray[i].visible){
_local1 = new Rectangle(setblockarray[i].x, setblockarray[i].y, 16, 16);
if (_local2.intersects(_local1)){
_local3 = Math.floor(((setblockarray[i].y + 8) - (_local2.y + 48)));
_local4 = Math.floor(((setblockarray[i].x + 8) - (_local2.x + 48)));
if (Math.abs(_local3) > 55){
trace(("y over " + _local3));
_local3 = 55;
};
if (Math.abs(_local4) > 55){
trace(("x over " + _local4));
_local4 = 55;
};
if (_local3 < 0){
setblockarray[i].ydecay = (ina[Math.abs(_local3)] * -1);
} else {
setblockarray[i].ydecay = (ina[_local3] * -1);
};
if (_local4 < 0){
setblockarray[i].xmov = (ina[Math.abs(_local4)] * -1);
} else {
setblockarray[i].xmov = ina[_local4];
};
setblockarray[i].xrot = randm(15, 60);
eblockarray.push(setblockarray[i]);
setblockarray.splice(i, 1);
};
};
i--;
};
i = 0;
while (i < eblockarray.length) {
reset(eblockarray[i]);
i++;
};
musspeedcheck();
break;
case 16:
case 26:
bgplayfield.spaz.gotoAndStop(2);
bgplayfield.spaz.visible = true;
bgplayfield.x = (bgplayfield.x + 8);
break;
case 17:
case 27:
bgplayfield.spaz.visible = !(bgplayfield.spaz.visible);
break;
case 18:
case 28:
bgplayfield.spaz.gotoAndStop(3);
bgplayfield.spaz.visible = !(bgplayfield.spaz.visible);
bgplayfield.x = (bgplayfield.x - 8);
bgplayfield.y = (bgplayfield.y - 8);
break;
case 19:
case 29:
bgplayfield.spaz.visible = !(bgplayfield.spaz.visible);
break;
case 20:
case 30:
bgplayfield.spaz.gotoAndStop(2);
bgplayfield.spaz.visible = !(bgplayfield.spaz.visible);
bgplayfield.x = (bgplayfield.x - 8);
bgplayfield.y = (bgplayfield.y + 8);
break;
case 21:
case 31:
bgplayfield.spaz.visible = !(bgplayfield.spaz.visible);
break;
case 22:
case 32:
bgplayfield.spaz.gotoAndStop(3);
bgplayfield.spaz.visible = !(bgplayfield.spaz.visible);
bgplayfield.x = (bgplayfield.x + 8);
bgplayfield.y = (bgplayfield.y + 8);
break;
case 23:
case 33:
bgplayfield.spaz.visible = !(bgplayfield.spaz.visible);
break;
case 24:
case 34:
bgplayfield.spaz.gotoAndStop(2);
bgplayfield.spaz.visible = !(bgplayfield.spaz.visible);
bgplayfield.y = (bgplayfield.y - 8);
break;
case 25:
case 35:
bgplayfield.spaz.gotoAndStop(1);
bgplayfield.spaz.visible = !(bgplayfield.spaz.visible);
break;
case 36:
removeChild(darray[0]);
crafttetrid();
};
darray[0].frame++;
darray[0].atick = getTimer();
};
};
};
}
function devisible(){
bgtitle.visible = false;
bgoptions.visible = false;
bgstarfield.visible = false;
bgplayfield.visible = false;
bggameover.visible = false;
bgpreface.visible = false;
bgcredits.visible = false;
}
function gameoverprep(){
devisible();
skullmode = false;
bggameover.gbhut.buttonMode = true;
bggameover.skull.visible = false;
bggameover.skull.scaleX = 1;
bggameover.skull.scaleY = 1;
bggameover.skull.x = 251;
bggameover.skull.y = 210;
bggameover.skull.img.rotation = 0;
skullframe = 0;
bggameover.rb.buttonMode = true;
bggameover.qb.buttonMode = true;
bggameover.visible = true;
gameoverplayed = false;
gameovertick = getTimer();
bggameover.clown.visible = false;
bggameover.shark.visible = false;
bggameover.tetris.visible = false;
bggameover.rb.visible = false;
bggameover.qb.visible = false;
bggameover.gbhut.visible = false;
playsound("mfx", "gameover");
reset(bggameover);
gamestate = stategameover;
}
function eblockrender(){
var _local1:Boolean;
if (eblockarray.length > 0){
if ((getTimer() - lastsplodetick1) >= 40){
_local1 = true;
i = (eblockarray.length - 1);
while (i >= 0) {
eblockarray[i].y = (eblockarray[i].y + (eblockarray[i].ydecay / 1.5));
eblockarray[i].ydecay = (eblockarray[i].ydecay + 2);
eblockarray[i].x = (eblockarray[i].x + eblockarray[i].xmov);
if ((((((((eblockarray[i].x < 612)) || ((eblockarray[i].x > -116)))) || ((eblockarray[i].y < 548)))) || ((eblockarray[i].y > -116)))){
_local1 = false;
};
i--;
};
if (_local1){
i = 0;
while (i < eblockarray.length) {
removeChild(eblockarray[i]);
i++;
};
eblockarray = new Array();
};
lastsplodetick1 = getTimer();
};
if ((getTimer() - lastsplodetick2) >= 20){
i = 0;
while (i < eblockarray.length) {
eblockarray[i].img.rotation = (eblockarray[i].img.rotation + eblockarray[i].xrot);
i++;
};
lastsplodetick2 = getTimer();
};
};
}
private function randm(_arg1:int, _arg2:int):int{
return (Math.floor(((((_arg2 - _arg1) + 1) * Math.random()) + _arg1)));
}
function starshoot(){
var _local1:cblock = new cblock();
_local1.x = (bgstarfield.ship.x + 62);
_local1.y = (bgstarfield.ship.y + 5);
_local1.img.gotoAndStop(randm(1, 6));
addChild(_local1);
starshotarray.push(_local1);
}
function init(){
bgstarfield = new cstarfield();
addChild(bgstarfield);
bgstarfield.visible = false;
bgplayfield = new cplayfield();
addChild(bgplayfield);
bgplayfield.visible = false;
i = 1;
while (i <= 20) {
deadarray.push(bgplayfield.getChildByName(("db" + i)));
i++;
};
i = 56;
while (i > 0) {
ina.push(i);
i--;
};
soundarray.push(new smenuselect());
soundarray.push(new smenutick());
soundarray.push(new srtypedeath());
soundarray.push(new srtypeshot());
soundarray.push(new stetrisblockset());
soundarray.push(new stetrisdeath());
soundarray.push(new stetrislineclear());
soundarray.push(new stetrismove());
soundarray.push(new stetrisnextlevel());
soundarray.push(new stetrisrotate());
soundarray.push(new stetristetris());
soundarray.push(new sbomb());
soundarray.push(new serror());
soundarray.push(new slaugh());
musicarray.push(new mrtypemusdeath());
musicarray.push(new mrtypemusintro());
musicarray.push(new mrtypemusstage());
musicarray.push(new msharksfin());
musicarray.push(new msharksfinfast());
musicarray.push(new mpolka());
musicarray.push(new mpolkafast());
musicarray.push(new mtetris());
musicarray.push(new mtetrisfast());
musicarray.push(new mgameover());
musicarray.push(new mtitle());
bgoptions = new coptions();
addChild(bgoptions);
bgoptions.visible = false;
bggameover = new cending();
bggameover.visible = false;
addChild(bggameover);
bgpreface = new cpreface();
addChild(bgpreface);
bgpreface.visible = false;
bgcredits = new ccredits();
addChild(bgcredits);
bgtitle = new ctitle();
addChild(bgtitle);
titleprep();
}
function setmusic(_arg1:int){
if (_arg1 == selmnum){
return;
};
selmnum = _arg1;
var _local2 = "";
switch (_arg1){
case 1:
_local2 = "tetris";
break;
case 2:
_local2 = "sharksfin";
break;
case 3:
_local2 = "polka";
break;
};
selmusic = _local2;
playsound("mfx", _local2);
}
function levelup(_arg1:int){
var _local2:*;
i = 0;
while (i < deadarray.length) {
deadarray[i].gotoAndStop(_arg1);
i++;
};
bgplayfield.statpic.gotoAndStop(_arg1);
if (_arg1 == 2){
playsound("sfx", "tetrisnextlevel");
i = 0;
while (i < bgplayfield.nextblocks.numChildren) {
_local2 = bgplayfield.nextblocks.getChildAt(i);
_local2.gotoAndStop((_local2.currentFrame + 3));
i++;
};
i = 0;
while (i < setblockarray.length) {
if (setblockarray[i].visible){
setblockarray[i].img.gotoAndStop((setblockarray[i].img.currentFrame + 3));
};
i++;
};
};
level = _arg1;
}
function divinenext(){
var _local3:*;
var _local4:int;
var _local1:int;
var _local2:int = currentshape;
if (!endgame){
while (_local2 == currentshape) {
_local2 = randm(1, 7);
};
nextblock = _local2;
if (((((!((currentshape == 8))) && ((level == 1)))) && ((setblockarray.length >= 4)))){
if (randm(1, 8) == 8){
nextblock = 8;
};
};
bgplayfield.nextblocks.gotoAndStop(nextblock);
} else {
_local2 = randm(0, (reducearray.length - 1));
nextblock = reducearray[_local2];
nextblock = (nextblock + 8);
reducearray.splice(_local2, 1);
};
if (nextblock < 8){
switch (nextblock){
case 1:
case 2:
case 3:
_local1 = 2;
break;
case 4:
case 5:
_local1 = 1;
break;
case 6:
case 7:
_local1 = 3;
break;
};
if (level == 2){
_local1 = (_local1 + 3);
};
_local4 = 0;
bgplayfield.nextblocks.visible = true;
bgplayfield.omegablocks.visible = false;
i = 0;
while (i < bgplayfield.nextblocks.numChildren) {
_local3 = bgplayfield.nextblocks.getChildAt(i);
_local3.gotoAndStop(_local1);
i++;
};
} else {
bgplayfield.omegablocks.gotoAndStop((nextblock - 7));
bgplayfield.nextblocks.visible = false;
bgplayfield.omegablocks.visible = true;
};
}
function updatevalues(){
var _local1:*;
var _local2 = "";
var _local3:int;
var _local4:int;
var _local5:int;
if ((((level > 2)) || ((lines > 19)))){
deadframe = 19;
dead = true;
finaldoomtick = 0;
return;
};
i = 1;
while (i <= 7) {
_local3 = 0;
_local4 = 0;
_local5 = 0;
_local2 = statarray[(i - 1)].toString();
if (_local2.length == 3){
_local3 = parseInt(_local2.charAt(0));
_local4 = parseInt(_local2.charAt(1));
_local5 = parseInt(_local2.charAt(2));
} else {
if (_local2.length == 2){
_local4 = parseInt(_local2.charAt(0));
_local5 = parseInt(_local2.charAt(1));
} else {
if (_local2.length == 1){
_local5 = parseInt(_local2);
};
};
};
_local1 = bgplayfield.getChildByName((("chrstat" + i) + "1"));
_local1.char.gotoAndStop((_local3 + 1));
_local1 = bgplayfield.getChildByName((("chrstat" + i) + "2"));
_local1.char.gotoAndStop((_local4 + 1));
_local1 = bgplayfield.getChildByName((("chrstat" + i) + "3"));
_local1.char.gotoAndStop((_local5 + 1));
i++;
};
_local2 = lines.toString();
_local3 = 0;
_local4 = 0;
_local5 = 0;
if (_local2.length == 3){
_local3 = parseInt(_local2.charAt(0));
_local4 = parseInt(_local2.charAt(1));
_local5 = parseInt(_local2.charAt(2));
} else {
if (_local2.length == 2){
_local4 = parseInt(_local2.charAt(0));
_local5 = parseInt(_local2.charAt(1));
} else {
if (_local2.length == 1){
_local5 = parseInt(_local2);
};
};
};
_local1 = bgplayfield.getChildByName("chrlines1");
_local1.char.gotoAndStop((_local3 + 1));
_local1 = bgplayfield.getChildByName("chrlines2");
_local1.char.gotoAndStop((_local4 + 1));
_local1 = bgplayfield.getChildByName("chrlines3");
_local1.char.gotoAndStop((_local5 + 1));
_local2 = level.toString();
_local3 = 0;
_local4 = 0;
if (_local2.length == 2){
_local3 = parseInt(_local2.charAt(0));
_local4 = parseInt(_local2.charAt(1));
} else {
if (_local2.length == 1){
_local4 = parseInt(_local2);
};
};
_local1 = bgplayfield.getChildByName("chrlevel1");
_local1.char.gotoAndStop((_local3 + 1));
_local1 = bgplayfield.getChildByName("chrlevel2");
_local1.char.gotoAndStop((_local4 + 1));
_local2 = score.toString();
i = 0;
while (i < _local2.length) {
_local3 = parseInt(_local2.charAt(((_local2.length - 1) - i)));
_local4 = (i + 1);
_local1 = bgplayfield.getChildByName(("chrscore" + _local4));
_local1.char.gotoAndStop((_local3 + 1));
i++;
};
}
function musspeedcheck(){
var _local1:int;
if (gamestate == stateplaying){
_local1 = 382;
i = 0;
while (i < setblockarray.length) {
if ((((setblockarray[i].y < _local1)) && (setblockarray[i].visible))){
_local1 = setblockarray[i].y;
};
i++;
};
if ((((_local1 <= 158)) && ((_local1 >= 78)))){
if (music == "sharksfin"){
playsound("mfx", "sharksfinfast");
};
if (music == "polka"){
playsound("mfx", "polkafast");
};
if (music == "tetris"){
playsound("mfx", "tetrisfast");
};
} else {
if (_local1 > 158){
if (music == "sharksfinfast"){
playsound("mfx", "sharksfin");
};
if (music == "polkafast"){
playsound("mfx", "polka");
};
if (music == "tetrisfast"){
playsound("mfx", "tetris");
};
};
};
} else {
if (gamestate == statestarfield){
if (music == "sharksfin"){
playsound("mfx", "sharksfinfast");
};
if (music == "polka"){
playsound("mfx", "polkafast");
};
if (music == "tetris"){
playsound("mfx", "tetrisfast");
};
};
};
}
public function loading(_arg1:TimerEvent){
var _local8:*;
var _local2:int = this.root.loaderInfo.bytesLoaded;
var _local3:int = this.root.loaderInfo.bytesTotal;
var _local4:Number = ((_local2 / _local3) * 100);
if (_local4 >= 100){
loader.gotoAndStop(13);
} else {
if (_local4 >= 90){
loader.gotoAndStop(12);
} else {
if (_local4 >= 82.5){
loader.gotoAndStop(11);
} else {
if (_local4 >= 75){
loader.gotoAndStop(10);
} else {
if (_local4 >= 67.5){
loader.gotoAndStop(9);
} else {
if (_local4 >= 60){
loader.gotoAndStop(8);
} else {
if (_local4 >= 52.5){
loader.gotoAndStop(7);
} else {
if (_local4 >= 45){
loader.gotoAndStop(6);
} else {
if (_local4 >= 37.5){
loader.gotoAndStop(5);
} else {
if (_local4 >= 30){
loader.gotoAndStop(4);
} else {
if (_local4 >= 22.5){
loader.gotoAndStop(3);
} else {
if (_local4 >= 15){
loader.gotoAndStop(2);
} else {
if (_local4 >= 7.5){
loader.visible = true;
loader.gotoAndStop(1);
};
};
};
};
};
};
};
};
};
};
};
};
};
if ((((_local4 > 7.5)) && (!(loader.visible)))){
loader.visible = true;
};
_local4 = Math.floor(_local4);
var _local5:String = _local4.toString();
var _local6:int;
var _local7:int;
var _local9:int;
_local9 = 0;
while (_local9 < _local5.length) {
_local6 = parseInt(_local5.charAt(((_local5.length - 1) - _local9)));
_local7 = (_local9 + 1);
_local8 = getChildByName(("p" + _local7));
_local8.char.gotoAndStop((_local6 + 1));
_local9++;
};
if (_local2 == _local3){
if (!allloaded){
loader.visible = true;
allloaded = true;
starttick = getTimer();
};
};
if (((allloaded) && (((getTimer() - starttick) >= 3000)))){
tmr.stop();
loader.visible = false;
nextFrame();
};
}
private function reset(_arg1:DisplayObject){
setChildIndex(_arg1, (numChildren - 1));
}
function userkeydown(_arg1:KeyboardEvent){
if (gamestate == stateplaying){
if (_arg1.keyCode == dirholding){
return;
};
switch (_arg1.keyCode){
case keyleft:
if (((descending) && (!((currentshape == 8))))){
relocatedescent(-16, 0, true);
dirholding = holdingleft;
};
break;
case keyright:
if (((descending) && (!((currentshape == 8))))){
relocatedescent(16, 0, true);
dirholding = holdingright;
};
break;
case keydown:
if (((descending) && (!((currentshape == 8))))){
if (reldown){
dirholding = holdingdown;
};
};
break;
case keyspace:
if (((descending) && (!((currentshape == 8))))){
rotate();
};
if (((dead) && ((deadframe > 18)))){
finaldoomtick = 0;
};
break;
};
} else {
if (gamestate == stategameover){
if (_arg1.keyCode == keyspace){
if (((!(skullmode)) && (gameoverplayed))){
playsound("sfx", "menuselect");
optionsprep();
};
};
} else {
if (gamestate == stateoptions){
switch (_arg1.keyCode){
case keyleft:
if (hleft){
return;
};
playsound("sfx", "menutick");
hleft = true;
if (bgoptions.stype.x == 125){
bgoptions.stype.x = 318;
} else {
bgoptions.stype.x = 125;
};
break;
case keyright:
if (hright){
return;
};
playsound("sfx", "menutick");
hright = true;
if (bgoptions.stype.x == 125){
bgoptions.stype.x = 318;
} else {
bgoptions.stype.x = 125;
};
break;
case keyup:
if (hup){
return;
};
playsound("sfx", "menutick");
hup = true;
bgoptions.smusic.y = (bgoptions.smusic.y - 32);
if (bgoptions.smusic.y < 272){
bgoptions.smusic.y = 336;
};
switch (bgoptions.smusic.y){
case 272:
setmusic(1);
break;
case 304:
setmusic(2);
break;
case 336:
setmusic(3);
break;
};
break;
case keydown:
if (hdown){
return;
};
playsound("sfx", "menutick");
hdown = true;
bgoptions.smusic.y = (bgoptions.smusic.y + 32);
if (bgoptions.smusic.y > 336){
bgoptions.smusic.y = 272;
};
switch (bgoptions.smusic.y){
case 272:
setmusic(1);
break;
case 304:
setmusic(2);
break;
case 336:
setmusic(3);
break;
};
break;
case keyspace:
if (bgoptions.stype.x == 125){
playsound("sfx", "menuselect");
playfieldprep();
} else {
starfieldprep();
};
break;
};
} else {
if (gamestate == statestarfield){
switch (_arg1.keyCode){
case keyleft:
hleft = true;
hright = false;
break;
case keyright:
hright = true;
hleft = false;
break;
case keyup:
if (hup){
return;
};
starleantick = getTimer();
hup = true;
hdown = false;
break;
case keydown:
if (hdown){
return;
};
starleantick = getTimer();
hdown = true;
hup = false;
break;
case keyspace:
if (hspace){
return;
};
hspace = true;
if (((!(starintro)) && (!(stardead)))){
playsound("sfx", "rtypeshot");
starshoot();
};
break;
};
} else {
if (gamestate == statetitle){
if (_arg1.keyCode == keyspace){
prefaceprep();
playsound("sfx", "menuselect");
};
} else {
if (gamestate == statepreface){
if (_arg1.keyCode == keyspace){
optionsprep();
};
} else {
if (gamestate == statecredits){
if (_arg1.keyCode == keyspace){
titleprep();
};
};
};
};
};
};
};
};
}
function rotate(){
var _local2:cblock;
var _local4:Rectangle;
var _local5:Rectangle;
var _local1:Array = new Array();
var _local3:int;
if (currentshape < 8){
i = 0;
while (i < 4) {
_local2 = new cblock();
_local2.x = darray[i].x;
_local2.y = darray[i].y;
_local1.push(_local2);
i++;
};
switch (currentshape){
case tetridline:
if (rots == 0){
_local1[0].x = _local1[2].x;
_local1[0].y = (_local1[2].y - 32);
_local1[1].x = _local1[2].x;
_local1[1].y = (_local1[2].y - 16);
_local1[3].x = _local1[2].x;
_local1[3].y = (_local1[2].y + 16);
_local3 = 1;
} else {
_local1[0].y = _local1[2].y;
_local1[0].x = (_local1[2].x - 32);
_local1[1].y = _local1[2].y;
_local1[1].x = (_local1[2].x - 16);
_local1[3].y = _local1[2].y;
_local1[3].x = (_local1[2].x + 16);
_local3 = 0;
};
break;
case tetridt:
if (rots == 0){
_local1[0].x = _local1[2].x;
_local1[0].y = (_local1[2].y - 16);
_local1[1].y = _local1[2].y;
_local1[1].x = (_local1[2].x + 16);
_local1[3].y = (_local1[2].y + 16);
_local1[3].x = _local1[2].x;
_local3 = 1;
} else {
if (rots == 1){
_local1[0].x = (_local1[2].x + 16);
_local1[0].y = _local1[2].y;
_local1[1].y = (_local1[2].y + 16);
_local1[1].x = _local1[2].x;
_local1[3].y = _local1[2].y;
_local1[3].x = (_local1[2].x - 16);
_local3 = 2;
} else {
if (rots == 2){
_local1[0].x = _local1[2].x;
_local1[0].y = (_local1[2].y + 16);
_local1[1].y = _local1[2].y;
_local1[1].x = (_local1[2].x - 16);
_local1[3].y = (_local1[2].y - 16);
_local1[3].x = _local1[2].x;
_local3 = 3;
} else {
if (rots == 3){
_local1[0].x = (_local1[2].x - 16);
_local1[0].y = _local1[2].y;
_local1[1].y = (_local1[2].y - 16);
_local1[1].x = _local1[2].x;
_local1[3].y = _local1[2].y;
_local1[3].x = (_local1[2].x + 16);
_local3 = 0;
};
};
};
};
break;
case tetrid7:
if (rots == 0){
_local1[0].x = _local1[1].x;
_local1[0].y = (_local1[1].y - 16);
_local1[2].y = (_local1[1].y + 16);
_local1[2].x = _local1[1].x;
_local1[3].y = (_local1[1].y + 16);
_local1[3].x = (_local1[1].x - 16);
_local3 = 1;
} else {
if (rots == 1){
_local1[0].x = (_local1[1].x + 16);
_local1[0].y = _local1[1].y;
_local1[2].y = _local1[1].y;
_local1[2].x = (_local1[1].x - 16);
_local1[3].y = (_local1[1].y - 16);
_local1[3].x = (_local1[1].x - 16);
_local3 = 2;
} else {
if (rots == 2){
_local1[0].x = _local1[1].x;
_local1[0].y = (_local1[1].y + 16);
_local1[2].y = (_local1[1].y - 16);
_local1[2].x = _local1[1].x;
_local1[3].y = (_local1[1].y - 16);
_local1[3].x = (_local1[1].x + 16);
_local3 = 3;
} else {
if (rots == 3){
_local1[0].x = (_local1[1].x - 16);
_local1[0].y = _local1[1].y;
_local1[2].y = _local1[1].y;
_local1[2].x = (_local1[1].x + 16);
_local1[3].y = (_local1[1].y + 16);
_local1[3].x = (_local1[1].x + 16);
_local3 = 0;
};
};
};
};
break;
case tetrid5:
if (rots == 0){
_local1[1].x = _local1[0].x;
_local1[1].y = (_local1[0].y + 16);
_local1[2].x = (_local1[0].x - 16);
_local1[2].y = (_local1[0].y - 16);
_local1[3].x = (_local1[0].x - 16);
_local1[3].y = _local1[0].y;
_local3 = 1;
} else {
_local1[1].x = (_local1[0].x + 16);
_local1[1].y = _local1[0].y;
_local1[2].x = (_local1[0].x - 16);
_local1[2].y = (_local1[0].y + 16);
_local1[3].x = _local1[0].x;
_local1[3].y = (_local1[0].y + 16);
_local3 = 0;
};
break;
case tetridl:
if (rots == 0){
_local1[0].x = _local1[1].x;
_local1[0].y = (_local1[1].y - 16);
_local1[2].y = (_local1[1].y + 16);
_local1[2].x = _local1[1].x;
_local1[3].y = (_local1[1].y - 16);
_local1[3].x = (_local1[1].x - 16);
_local3 = 1;
} else {
if (rots == 1){
_local1[0].x = (_local1[1].x + 16);
_local1[0].y = _local1[1].y;
_local1[2].y = _local1[1].y;
_local1[2].x = (_local1[1].x - 16);
_local1[3].y = (_local1[1].y - 16);
_local1[3].x = (_local1[1].x + 16);
_local3 = 2;
} else {
if (rots == 2){
_local1[0].x = _local1[1].x;
_local1[0].y = (_local1[1].y + 16);
_local1[2].y = (_local1[1].y - 16);
_local1[2].x = _local1[1].x;
_local1[3].y = (_local1[1].y + 16);
_local1[3].x = (_local1[1].x + 16);
_local3 = 3;
} else {
if (rots == 3){
_local1[0].x = (_local1[1].x - 16);
_local1[0].y = _local1[1].y;
_local1[2].y = _local1[1].y;
_local1[2].x = (_local1[1].x + 16);
_local1[3].y = (_local1[1].y + 16);
_local1[3].x = (_local1[1].x - 16);
_local3 = 0;
};
};
};
};
break;
case tetrids:
if (rots == 0){
_local1[0].x = _local1[1].x;
_local1[0].y = (_local1[1].y - 16);
_local1[2].x = (_local1[1].x - 16);
_local1[2].y = _local1[1].y;
_local1[3].x = (_local1[1].x - 16);
_local1[3].y = (_local1[1].y + 16);
_local3 = 1;
} else {
_local1[0].x = (_local1[1].x - 16);
_local1[0].y = _local1[1].y;
_local1[2].x = _local1[1].x;
_local1[2].y = (_local1[1].y + 16);
_local1[3].x = (_local1[1].x + 16);
_local1[3].y = (_local1[1].y + 16);
_local3 = 0;
};
break;
};
} else {
darray[0].visible = false;
darray[0].img.rotation = (darray[0].img.rotation + 90);
i = 0;
while (i < hitboxarray.length) {
_local1.push(hitboxarray[i].getRect(this));
i++;
};
darray[0].img.rotation = (darray[0].img.rotation - 90);
darray[0].visible = true;
};
var _local6:Boolean;
i = 0;
while (i < setblockarray.length) {
_local4 = new Rectangle(setblockarray[i].x, setblockarray[i].y, setblockarray[i].width, setblockarray[i].height);
k = 0;
while (k < _local1.length) {
_local5 = new Rectangle(_local1[k].x, _local1[k].y, _local1[k].width, _local1[k].height);
if (_local4.intersects(_local5)){
_local6 = true;
};
k++;
};
i++;
};
if (!_local6){
playsound("sfx", "tetrisrotate");
if (currentshape < 9){
i = 0;
while (i < 4) {
darray[i].x = _local1[i].x;
darray[i].y = _local1[i].y;
i++;
};
rots = _local3;
} else {
darray[0].img.rotation = (darray[0].img.rotation + 90);
};
if (finalsolution){
lastmomentstick = getTimer();
};
};
}
function playfieldprep(){
var _local2:*;
bgtitle.visible = false;
bgoptions.visible = false;
bgstarfield.visible = false;
bggameover.visible = false;
descending = false;
setblockarray = new Array();
disable = false;
deadframe = 0;
dead = false;
endgame = false;
reducearray = new Array();
purgearray = new Array();
eblockarray = new Array();
var _local1:gdropobjects = new gdropobjects();
i = 1;
while (i <= _local1.totalFrames) {
reducearray.push(i);
i++;
};
bgplayfield.spaz.gotoAndStop(1);
setblockarray.push(bgplayfield.bb1);
setblockarray.push(bgplayfield.bb2);
setblockarray.push(bgplayfield.bb3);
statarray = new Array();
i = 0;
while (i < deadarray.length) {
deadarray[i].visible = false;
i++;
};
i = 1;
while (i <= 7) {
statarray.push((0 + 0));
i++;
};
i = 1;
while (i <= 6) {
_local2 = bgplayfield.getChildByName(("chrscore" + i));
_local2.char.gotoAndStop(1);
i++;
};
levelup(1);
minidig = 0;
level = 1;
score = 0;
lines = 0;
updatevalues();
downspeed = 240;
dirholding = 0;
reldown = true;
finalsolution = false;
bgplayfield.visible = true;
reset(bgplayfield);
divinenext();
gamestate = stateplaying;
crafttetrid();
}
function prefaceprep(){
devisible();
bgpreface.visible = true;
reset(bgpreface);
gamestate = statepreface;
}
function RENDER(_arg1:Event){
var _local2:int;
var _local3:int;
var _local4:Rectangle;
var _local5:Rectangle;
var _local6:Boolean;
var _local7:int;
var _local8:cblock;
var _local9:int;
var _local10:int;
var _local11:int;
if (gamestate == stateloading){
if (currentFrame == 2){
init();
};
} else {
if (gamestate == stategameover){
if (!gameoverplayed){
if (((((getTimer() - gameovertick) >= 5800)) || ((bgmsoundchannel.position >= 5450)))){
gameoverplayed = true;
playsound("mfx", selmusic);
bggameover.rb.visible = true;
bggameover.qb.visible = true;
bggameover.gbhut.visible = true;
switch (selmnum){
case 1:
i = 0;
while (i < bggameover.tetris.loserarray.length) {
bggameover.tetris.loserarray[i].img.gotoAndStop(1);
i++;
};
bggameover.tetris.od.x = 0;
bggameover.tetris.od.y = 0;
bggameover.tetris.od.width = 304;
bggameover.tetris.od.height = 80;
bggameover.tetris.frame = 0;
bggameover.tetris.od.visible = true;
bggameover.tetris.visible = true;
bggameover.tetris.movetick = getTimer();
break;
case 2:
bggameover.shark.img.scaleX = -1;
bggameover.shark.x = -150;
bggameover.shark.img.gotoAndStop(1);
bggameover.shark.visible = true;
break;
case 3:
bggameover.clown.img.scaleX = 1;
bggameover.clown.x = 0;
bggameover.clown.y = 347;
clownup = true;
bggameover.clown.img.gotoAndStop(1);
bggameover.clown.visible = true;
break;
};
};
};
if (gameoverplayed){
switch (selmnum){
case 1:
if (bggameover.tetris.frame < 6){
if ((getTimer() - bggameover.tetris.movetick) >= 540){
if (bggameover.tetris.od.width >= 64){
bggameover.tetris.od.x = (bggameover.tetris.od.x + 64);
bggameover.tetris.od.width = (bggameover.tetris.od.width - 64);
};
if (bggameover.tetris.frame > 3){
bggameover.tetris.od.visible = false;
};
bggameover.tetris.frame++;
bggameover.tetris.movetick = getTimer();
};
} else {
if ((getTimer() - bggameover.tetris.anitick) >= 120){
i = 0;
while (i < bggameover.tetris.loserarray.length) {
bggameover.tetris.loserarray[i].img.gotoAndStop(randm(1, 6));
i++;
};
bggameover.tetris.anitick = getTimer();
};
};
break;
case 2:
if ((getTimer() - bggameover.shark.anitick) >= 320){
if (bggameover.shark.img.currentFrame == 6){
bggameover.shark.img.gotoAndStop(1);
} else {
bggameover.shark.img.gotoAndStop((bggameover.shark.img.currentFrame + 1));
};
bggameover.shark.anitick = getTimer();
};
if ((getTimer() - bggameover.shark.movetick) >= 60){
switch (bggameover.shark.img.scaleX){
case -1:
bggameover.shark.x = (bggameover.shark.x + 6);
if (bggameover.shark.x >= 486){
bggameover.shark.img.scaleX = 1;
};
break;
case 1:
bggameover.shark.x = (bggameover.shark.x - 6);
if (bggameover.shark.x <= -180){
bggameover.shark.img.scaleX = -1;
};
break;
};
bggameover.shark.movetick = getTimer();
};
break;
case 3:
if ((getTimer() - bggameover.clown.anitick) >= 120){
if (bggameover.clown.img.currentFrame == 2){
bggameover.clown.img.gotoAndStop(1);
} else {
bggameover.clown.img.gotoAndStop(2);
};
bggameover.clown.anitick = getTimer();
};
if ((getTimer() - bggameover.clown.movetick) >= 60){
switch (bggameover.clown.img.scaleX){
case -1:
bggameover.clown.x = (bggameover.clown.x - 6);
if (bggameover.clown.x <= 0){
bggameover.clown.img.scaleX = 1;
};
break;
case 1:
bggameover.clown.x = (bggameover.clown.x + 6);
if (bggameover.clown.x >= 298){
bggameover.clown.img.scaleX = -1;
};
break;
};
if (clownup){
bggameover.clown.y = (bggameover.clown.y - 6);
if (bggameover.clown.y <= 273){
clownup = false;
};
} else {
bggameover.clown.y = (bggameover.clown.y + 6);
if (bggameover.clown.y >= 347){
clownup = true;
};
};
bggameover.clown.movetick = getTimer();
};
break;
};
};
if (skullmode){
if (skullframe > 18){
if ((getTimer() - skullatick) >= 160){
if (bggameover.skull.img.currentFrame == 2){
bggameover.skull.img.gotoAndStop(3);
} else {
bggameover.skull.img.gotoAndStop(2);
};
skullatick = getTimer();
};
} else {
if (skullframe == 12){
bggameover.skull.img.gotoAndStop(4);
} else {
if (skullframe == 14){
bggameover.skull.img.gotoAndStop(2);
skullatick = (getTimer() + 560);
};
};
};
if ((getTimer() - skullmtick) >= 120){
if (skullframe == 18){
playsound("sfx", "laugh");
} else {
if (skullframe > 18){
bggameover.skull.scaleX = (bggameover.skull.scaleX + 1);
bggameover.skull.scaleY = (bggameover.skull.scaleY + 1);
bggameover.skull.x = (bggameover.skull.x - 20);
bggameover.skull.y = (bggameover.skull.y - 20);
bggameover.skull.img.rotation = (bggameover.skull.img.rotation + 30);
};
};
skullframe++;
skullmtick = getTimer();
};
if (skullframe >= 60){
bggameover.skull.visible = false;
bggameover.gbhut.visible = true;
bggameover.rb.buttonMode = true;
bggameover.qb.buttonMode = true;
skullmode = false;
};
};
} else {
if (gamestate == statetitle){
if (((!(fireworking)) && (((getTimer() - fireworklagtick) >= 3000)))){
fireworking = true;
fireworkframe = 0;
fireworkoffset = (randm(0, 2) * 6);
bgtitle.fw.x = randm(82, 431);
bgtitle.fw.y = randm(182, 239);
} else {
if (fireworking){
if ((getTimer() - fireworktick) >= 100){
switch (fireworkframe){
case 0:
bgtitle.fw.gotoAndStop((1 + fireworkoffset));
bgtitle.fw.visible = true;
break;
case 1:
bgtitle.fw.gotoAndStop((2 + fireworkoffset));
break;
case 2:
bgtitle.fw.gotoAndStop((3 + fireworkoffset));
break;
case 3:
bgtitle.fw.gotoAndStop((4 + fireworkoffset));
break;
case 4:
bgtitle.fw.gotoAndStop((5 + fireworkoffset));
break;
case 5:
bgtitle.fw.gotoAndStop((6 + fireworkoffset));
break;
};
if (fireworkframe >= 6){
bgtitle.fw.visible = false;
fireworkframe = 0;
fireworking = false;
fireworklagtick = getTimer();
} else {
fireworkframe++;
};
fireworktick = getTimer();
};
};
};
} else {
if (gamestate == stateoptions){
if ((getTimer() - lasttick) >= 50){
bgoptions.stype.visible = !(bgoptions.stype.visible);
bgoptions.smusic.visible = !(bgoptions.smusic.visible);
lasttick = getTimer();
};
if (optionerror){
if ((getTimer() - errtick) >= 120){
switch (errorframe){
case 0:
case 2:
case 4:
case 6:
bgoptions.gbm4.visible = false;
bgoptions.berror.gotoAndStop(1);
bgoptions.berror.visible = true;
break;
case 1:
case 3:
case 5:
case 7:
bgoptions.berror.gotoAndStop(2);
break;
};
errorframe++;
if (errorframe > 7){
bgoptions.berror.visible = false;
bgoptions.gbm4.visible = true;
errorframe = 0;
optionerror = false;
};
errtick = getTimer();
};
};
} else {
if (gamestate == statestarfield){
if (!stardead){
if ((getTimer() - starbgtick) >= 50){
bgstarfield.bg1.x = (bgstarfield.bg1.x - 4);
bgstarfield.bg2.x = (bgstarfield.bg2.x - 4);
if (bgstarfield.bg1.x <= -640){
bgstarfield.bg1.x = (bgstarfield.bg2.x + 640);
};
if (bgstarfield.bg2.x <= -640){
bgstarfield.bg2.x = (bgstarfield.bg1.x + 640);
};
starbgtick = getTimer();
};
};
if (starintro){
if ((getTimer() - starintroflametick) >= 60){
switch (starflameframe){
case 0:
case 2:
bgstarfield.flame.gotoAndStop(2);
break;
case 1:
bgstarfield.flame.gotoAndStop(3);
break;
case 3:
bgstarfield.flame.gotoAndStop(1);
break;
};
starflameframe++;
if (starflameframe >= 4){
starflameframe = 0;
};
starintroflametick = getTimer();
};
if ((getTimer() - starleantick) >= 500){
switch (starintroframe){
case 0:
case 2:
bgstarfield.ship.gotoAndStop(2);
break;
case 1:
bgstarfield.ship.gotoAndStop(3);
break;
case 3:
case 7:
bgstarfield.ship.gotoAndStop(1);
break;
case 4:
case 6:
bgstarfield.ship.gotoAndStop(4);
break;
case 5:
bgstarfield.ship.gotoAndStop(5);
break;
};
starintroframe++;
if (starintroframe > 7){
starintroframe = 0;
};
starleantick = getTimer();
};
if ((getTimer() - starmovetick) >= 60){
if (!starreturntrip){
bgstarfield.ship.x = (bgstarfield.ship.x + 16);
bgstarfield.flame.x = (bgstarfield.flame.x + 16);
if (bgstarfield.ship.x >= 460){
starreturntrip = true;
};
} else {
bgstarfield.ship.x = (bgstarfield.ship.x - 16);
bgstarfield.flame.x = (bgstarfield.flame.x - 16);
if (bgstarfield.ship.x <= 42){
starintro = false;
bgstarfield.flame.visible = false;
bgstarfield.ship.gotoAndStop(1);
};
};
starmovetick = getTimer();
};
} else {
if (!stardead){
if (starintrosong){
if (((((getTimer() - starsongtick) >= 15630)) || ((bgmsoundchannel.position >= 15450)))){
starintrosong = false;
if (!fireworked){
playsound("mfx", selmusic);
} else {
playsound("mfx", "rtypemusstage");
};
};
};
_local2 = 0;
_local3 = 0;
if (hup){
if ((getTimer() - starleantick) >= 300){
switch (bgstarfield.ship.currentFrame){
case 1:
bgstarfield.ship.gotoAndStop(2);
break;
case 2:
bgstarfield.ship.gotoAndStop(3);
break;
case 4:
bgstarfield.ship.gotoAndStop(1);
break;
case 5:
bgstarfield.ship.gotoAndStop(4);
break;
};
starleantick = getTimer();
};
_local3 = -8;
} else {
if (hdown){
if ((getTimer() - starleantick) >= 300){
switch (bgstarfield.ship.currentFrame){
case 1:
bgstarfield.ship.gotoAndStop(4);
break;
case 4:
bgstarfield.ship.gotoAndStop(5);
break;
case 3:
bgstarfield.ship.gotoAndStop(2);
break;
case 2:
bgstarfield.ship.gotoAndStop(1);
break;
};
starleantick = getTimer();
};
_local3 = 8;
} else {
if (((!(hup)) && (!(hdown)))){
if ((getTimer() - starleantick) >= 300){
switch (bgstarfield.ship.currentFrame){
case 2:
bgstarfield.ship.gotoAndStop(1);
break;
case 3:
bgstarfield.ship.gotoAndStop(2);
break;
case 4:
bgstarfield.ship.gotoAndStop(1);
break;
case 5:
bgstarfield.ship.gotoAndStop(4);
break;
};
starleantick = getTimer();
};
};
};
};
if (hright){
_local2 = 8;
} else {
if (hleft){
_local2 = -8;
};
};
if ((getTimer() - starmovetick) >= 40){
if (((((bgstarfield.ship.x + _local2) > 8)) && (((bgstarfield.ship.x + _local2) < 442)))){
bgstarfield.ship.x = (bgstarfield.ship.x + _local2);
};
if (((((bgstarfield.ship.y + _local3) > 8)) && (((bgstarfield.ship.y + _local3) < 426)))){
bgstarfield.ship.y = (bgstarfield.ship.y + _local3);
};
starmovetick = getTimer();
};
if ((getTimer() - starshottick) >= 30){
i = 0;
while (i < starshotarray.length) {
if (starshotarray[i].enabled){
starshotarray[i].x = (starshotarray[i].x + 14);
starshotarray[i].img.rotation = (starshotarray[i].img.rotation + 15);
if (starshotarray[i].x > 0x0200){
starshotarray[i].enabled = false;
removeChild(starshotarray[i]);
};
};
i++;
};
i = (starshotarray.length - 1);
while (i >= 0) {
if (starshotarray[i].enabled == false){
starshotarray.splice(i, 1);
};
i--;
};
starshottick = getTimer();
};
if ((getTimer() - starsetmovetick) >= starsetdelay){
starsetframe++;
if (starsetframe >= 1){
_local9 = randm(2, 25);
if (fireworked){
_local9 = 14;
};
i = 1;
while (i <= 26) {
_local8 = new cblock();
_local8.x = 528;
_local8.y = (i * 16);
if (i != _local9){
_local8.img.gotoAndStop(randm(1, 6));
} else {
_local8.img.gotoAndStop(7);
};
addChild(_local8);
starblockarray.push(_local8);
i++;
};
starsetframe = 0;
};
i = 0;
while (i < starblockarray.length) {
starblockarray[i].x = (starblockarray[i].x - 16);
i++;
};
starsetmovetick = getTimer();
};
if ((getTimer() - lasttick) >= 1000){
starsetdelay = (starsetdelay - 16);
if (starsetdelay == 492){
musspeedcheck();
};
lasttick = getTimer();
};
_local6 = false;
_local7 = 0;
leftmostset = 528;
i = 0;
while (i < starblockarray.length) {
if (starblockarray[i].enabled){
if (starblockarray[i].x < leftmostset){
leftmostset = starblockarray[i].x;
};
};
i++;
};
i = 0;
while (i < starshotarray.length) {
_local4 = new Rectangle(starshotarray[i].x, starshotarray[i].y, 16, 16);
_local6 = false;
if (starshotarray[i].enabled){
j = 0;
while (j < starblockarray.length) {
if (starblockarray[j].enabled){
_local5 = new Rectangle(starblockarray[j].x, starblockarray[j].y, 16, 16);
if (((((_local4.intersects(_local5)) && ((starblockarray[j].img.currentFrame == 7)))) && ((starblockarray[j].x == leftmostset)))){
if (starshotarray[i].enabled){
_local6 = true;
_local7 = starblockarray[j].x;
starblockarray[j].img.gotoAndStop(starshotarray[i].img.currentFrame);
starshotarray[i].enabled = false;
removeChild(starshotarray[i]);
};
};
};
j++;
};
};
if (_local6){
j = 0;
while (j < starblockarray.length) {
if (starblockarray[j].x == _local7){
starblockarray[j].enabled = false;
};
j++;
};
playsound("sfx", "tetrislineclear");
};
i++;
};
i = 0;
while (i < starshotarray.length) {
_local4 = new Rectangle(starshotarray[i].x, starshotarray[i].y, 16, 16);
if (starshotarray[i].enabled){
j = 0;
while (j < starblockarray.length) {
if (starblockarray[j].enabled){
_local5 = new Rectangle(starblockarray[j].x, starblockarray[j].y, 16, 16);
if (((_local4.intersects(_local5)) && (starshotarray[i].enabled))){
starshotarray[i].enabled = false;
removeChild(starshotarray[i]);
};
};
j++;
};
};
i++;
};
_local4 = new Rectangle(bgstarfield.ship.x, bgstarfield.ship.y, bgstarfield.ship.width, bgstarfield.ship.height);
i = 0;
while (i < starblockarray.length) {
if (starblockarray[i].enabled){
_local5 = new Rectangle(starblockarray[i].x, starblockarray[i].y, 16, 16);
if (_local4.intersects(_local5)){
stardeadframe = 0;
starmovetick = getTimer();
stardead = true;
};
};
i++;
};
if (stardead){
playsound("sfx", "rtypedeath");
playsound("mfx", "rtypemusdeath");
};
if ((getTimer() - starsetdietick) >= 60){
i = 0;
while (i < starblockarray.length) {
if (!starblockarray[i].enabled){
starblockarray[i].alpha = (starblockarray[i].alpha - 0.1);
if (starblockarray[i].alpha <= 0){
starblockarray[i].visible = false;
removeChild(starblockarray[i]);
};
};
i++;
};
starsetdietick = getTimer();
};
i = (starblockarray.length - 1);
while (i >= 0) {
if (!starblockarray[i].visible){
starblockarray.splice(i, 1);
};
i--;
};
} else {
if ((getTimer() - starmovetick) >= 80){
switch (stardeadframe){
case 0:
bgstarfield.ship.gotoAndStop(6);
break;
case 1:
bgstarfield.ship.gotoAndStop(7);
break;
case 2:
bgstarfield.ship.gotoAndStop(8);
break;
case 3:
bgstarfield.ship.gotoAndStop(9);
break;
case 4:
bgstarfield.ship.gotoAndStop(10);
break;
case 5:
bgstarfield.ship.gotoAndStop(11);
break;
};
stardeadframe++;
starmovetick = getTimer();
if (stardeadframe > 80){
i = 0;
while (i < starshotarray.length) {
trace(("shot" + i));
if (starshotarray[i].enabled){
removeChild(starshotarray[i]);
};
i++;
};
i = 0;
while (i < starblockarray.length) {
removeChild(starblockarray[i]);
i++;
};
titleprep();
};
};
};
};
} else {
if (gamestate == stateplaying){
if (!descending){
if (disable){
if (((((getTimer() - spaztick) >= 40)) && ((disablearray.length == 4)))){
bgplayfield.spaz.visible = !(bgplayfield.spaz.visible);
spaztick = getTimer();
};
if ((getTimer() - disabletick) >= 120){
_local10 = 0;
_local11 = 0;
switch (disableframe){
case 0:
_local10 = 254;
_local11 = 270;
break;
case 1:
_local10 = 238;
_local11 = 286;
break;
case 2:
_local10 = 222;
_local11 = 302;
break;
case 3:
_local10 = 206;
_local11 = 318;
break;
case 4:
_local10 = 190;
_local11 = 334;
break;
};
if (disableframe < 5){
i = 0;
while (i < disablearray.length) {
j = 0;
while (j < setblockarray.length) {
if (setblockarray[j].y == disablearray[i]){
if ((((setblockarray[j].x == _local10)) || ((setblockarray[j].x == _local11)))){
removeChild(setblockarray[j]);
setblockarray[j].enabled = false;
};
};
j++;
};
i++;
};
};
i = (setblockarray.length - 1);
while (i >= 0) {
if (!setblockarray[i].enabled){
setblockarray.splice(i, 1);
};
i--;
};
disableframe++;
disabletick = getTimer();
if (disableframe > 5){
i = 0;
while (i < disablearray.length) {
j = 0;
while (j < setblockarray.length) {
if (setblockarray[j].y < disablearray[i]){
if (setblockarray[j].visible){
setblockarray[j].y = (setblockarray[j].y + 16);
};
};
j++;
};
i++;
};
lines = (lines + disablearray.length);
if (lines > 19){
lines = 19;
};
if ((((lines >= 10)) && ((level == 1)))){
levelup(2);
} else {
if ((((lines >= 16)) && (!(endgame)))){
endgame = true;
};
};
switch (disablearray.length){
case 1:
score = (score + 40);
break;
case 2:
score = (score + 110);
break;
case 3:
score = (score + 300);
break;
case 4:
score = (score + 1200);
break;
};
bgplayfield.spaz.visible = false;
disable = false;
musspeedcheck();
crafttetrid();
};
};
};
} else {
if (dirholding == holdingdown){
downspeed = 20;
} else {
downspeed = 240;
};
switch (currentshape){
case 8:
bombrender();
break;
};
if ((getTimer() - lastdtick) >= downspeed){
relocatedescent(0, 8, true);
lastdtick = getTimer();
};
if (finalsolution){
if ((getTimer() - lastmomentstick) >= 350){
if (currentshape != 8){
finalsolution = false;
descending = false;
setblocks();
} else {
if (currentshape == 8){
if (!darray[0].setdown){
darray[0].boomtick = getTimer();
};
darray[0].setdown = true;
};
};
};
if ((getTimer() - darray[0].boomtick) >= 1500){
dirholding = holdingdown;
};
};
};
eblockrender();
if (dead){
if ((((deadframe >= 19)) && (((getTimer() - finaldoomtick) >= 3500)))){
i = 0;
while (i < setblockarray.length) {
if (setblockarray[i].visible){
removeChild(setblockarray[i]);
};
i++;
};
i = 0;
while (i < purgearray.length) {
removeChild(purgearray[i]);
i++;
};
gameoverprep();
};
if ((getTimer() - deadtick) >= 80){
deadarray[deadframe].visible = true;
deadframe++;
deadtick = getTimer();
if (deadframe == 18){
finaldoomtick = getTimer();
};
if (deadframe >= 20){
deadframe = 19;
};
};
};
};
};
};
};
};
};
}
function creditsprep(){
devisible();
bgcredits.visible = true;
reset(bgcredits);
gamestate = statecredits;
}
public function optionsprep(){
devisible();
optionerror = false;
errorframe = 0;
bgoptions.berror.visible = false;
bgoptions.gbm4.visible = true;
hdown = false;
hup = false;
hleft = false;
hright = false;
bgoptions.visible = true;
bgoptions.stype.visible = true;
bgoptions.smusic.visible = true;
reset(bgoptions);
gamestate = stateoptions;
if (music != selmusic){
playsound("mfx", selmusic);
};
}
function relocatedescent(_arg1:int, _arg2:int, _arg3:Boolean){
var _local7:Rectangle;
var _local8:Rectangle;
var _local9:Rectangle;
var _local15:*;
var _local16:String;
if ((((currentshape == 8)) && ((darray[0].frame > 0)))){
return;
};
if (!_arg3){
if (dirholding == holdingdown){
reldown = false;
dirholding = holdingnull;
};
_arg1 = (_arg1 - darray[0].x);
_arg2 = (_arg2 - darray[0].y);
switch (currentshape){
case 2:
case 3:
case 4:
case 6:
case 7:
_arg1 = (_arg1 + 16);
break;
case 5:
_arg1 = (_arg1 + 32);
break;
case 8:
_arg1 = ((randm(11, 19) * 16) + 14);
break;
};
if (currentshape > 8){
_arg2 = -((darray[0].height / 8));
};
};
var _local4:int;
var _local5:int = darray[0].x;
var _local6:int = darray[0].y;
i = 0;
while (i < darray.length) {
if (darray[i].x > _local4){
_local4 = darray[i].x;
};
if (darray[i].x < _local5){
_local5 = darray[i].x;
};
if (darray[i].y > _local6){
_local6 = darray[i].y;
};
i++;
};
_local4 = (_local4 + 16);
_local6 = (_local6 + 16);
if (finalsolution){
if (dirholding == holdingdown){
endofdaystick = 0;
lastmomentstick = 0;
};
} else {
if ((getTimer() - lastmomentstick) > 1000){
endofdaystick = getTimer();
};
};
var _local10:Boolean;
var _local11:Boolean;
var _local12:Boolean;
if (_arg1 != 0){
_local12 = true;
};
var _local13:int;
var _local14:int;
if (_arg3){
if ((((currentshape > 8)) && ((hitboxarray.length == 0)))){
_local16 = "";
i = 0;
while (i < darray[0].img.numChildren) {
_local15 = darray[0].img.getChildAt(i);
_local16 = _local15.name;
if (_local16.charAt(0) == "g"){
hitboxarray.push(_local15);
};
i++;
};
};
i = 0;
while (i < setblockarray.length) {
_local7 = new Rectangle(setblockarray[i].x, setblockarray[i].y, setblockarray[i].width, setblockarray[i].height);
if (currentshape < 9){
k = 0;
while (k < darray.length) {
_local8 = new Rectangle((darray[k].x + _arg1), darray[k].y, darray[k].width, darray[k].height);
_local9 = new Rectangle(darray[k].x, (darray[k].y + _arg2), darray[k].width, darray[k].height);
if (_local7.intersects(_local8)){
_arg1 = 0;
_local11 = true;
};
if (_local7.intersects(_local9)){
if (!finalsolution){
finalsolution = true;
lastmomentstick = getTimer();
_local10 = true;
};
_arg2 = 0;
};
k++;
};
} else {
if ((((hitboxarray.length > 0)) && ((currentshape >= 9)))){
k = 0;
while (k < hitboxarray.length) {
_local13 = ((darray[0].x + hitboxarray[k].x) + (darray[0].width / 2));
_local14 = ((darray[0].y + hitboxarray[k].y) + (darray[0].height / 2));
_local8 = hitboxarray[k].getRect(this);
_local9 = hitboxarray[k].getRect(this);
_local8.x = (_local8.x + _arg1);
_local9.y = (_local9.y + _arg2);
if (_local7.intersects(_local8)){
_arg1 = 0;
_local11 = true;
};
if (_local7.intersects(_local9)){
if (!finalsolution){
finalsolution = true;
lastmomentstick = getTimer();
_local10 = true;
};
_arg2 = 0;
};
k++;
};
};
};
i++;
};
};
if (((!(_local10)) && ((_arg2 > 0)))){
finalsolution = false;
if (currentshape < 8){
if (dirholding == holdingdown){
minidig++;
if (minidig >= 3){
score++;
minidig = 0;
};
};
} else {
if (currentshape == 8){
darray[0].boomtick = getTimer();
darray[0].frame = 0;
if (darray[0].img.currentFrame > 2){
darray[0].img.gotoAndStop(1);
};
darray[0].setdown = false;
};
};
};
switch (currentshape){
case 8:
if (_local11){
darray[0].dir = (darray[0].dir * -1);
};
break;
};
if (((((!((_arg1 == 0))) && (_arg3))) && (!((currentshape == 8))))){
playsound("sfx", "tetrismove");
};
if (((((_local12) && (!(_local11)))) && (finalsolution))){
lastmomentstick = getTimer();
};
i = 0;
while (i < darray.length) {
darray[i].x = (darray[i].x + _arg1);
darray[i].y = (darray[i].y + _arg2);
i++;
};
}
}
}//package