home *** CD-ROM | disk | FTP | other *** search
Wrap
Text File | 2005-08-04 | 65.3 KB | 2,199 lines
function Screen(numColours, level, difficulty) { ID = 10000; this.ballCount = 0; this.difficulty = difficulty; this.level = level; this.loseRow = 2; this.numColours = numColours; this.ID = 200; this.canGo = true; this.canGo2 = true; this.ballSize = 26; this.halfBS = 13; this.rowSize = this.ballSize * 0.87; this.mc = createEmptyMovieClip("screen",0); this.mc._y = 40 - 2 * this.rowSize; this.mc._x = 46; this.mc.myObject = this; this.numRows = 16; this.numCollumns = 14; this.fallSpeed = 13; this.sideX = this.ballSize / 2 * this.numcollumns; this.amountOfColours = new Array(); this.waitBallsArray = new Array(); this.ballsArray = new Array(); this.rowsY = new Array(); this.rowsIsOffSet = new Array(); this.collumnsX = new Array(); this.rowsArray = new Array(); this.floorX = new Array(); var i = 0; while(i <= this.numRows) { this.rowsArray[i] = new Array(); this.rowsY[i] = this.ballSize / 2 + (i + 2) * (this.ballSize * 0.87); i++; } var i = 0; while(i < this.numCollumns) { this.collumnsX[i] = this.ballSize / 2 + this.ballSize / 2 * i; this.rowsArray[this.numRows][i] = "floor"; if(i % 2 == 0) { this.floorX[i] = this.collumnsX[i]; } i++; } this.floorY = floorY = this.ballSize + this.ballSize * 0.87 * (this.numRows + 1); this.mc.wdth = screenWidth = this.collumnsX[this.numCollumns - 1] + this.ballSize / 2; this.mc.hgth = screenHeight = this.floorY - this.ballSize / 2 + this.ballSize * 0.13; this.bg = this.mc.attachMovie("_lscreen","screen",1); this.bg._visible = 0; this.bg._width = this.mc.wdth; this.bg._height = this.mc.hgth; this.platform = this.mc.attachMovie("_lplatform","platform",2); this.platform._y = this.floorY - 6; } function InstructionScreen(numColours, level, difficulty) { ID = 10000; this.ballCount = 0; this.difficulty = difficulty; this.level = level; this.loseRow = 2; this.numColours = numColours; this.ID = 200; this.canGo = true; this.canGo2 = true; this.ballSize = 26; this.halfBS = 13; this.rowSize = this.ballSize * 0.87; this.mc = createEmptyMovieClip("screen",0); this.mc._y = 40 - 2 * this.rowSize; this.mc._x = 46; this.mc.myObject = this; this.numRows = 16; this.numCollumns = 14; this.fallSpeed = 13; this.sideX = this.ballSize / 2 * this.numcollumns; this.amountOfColours = new Array(); this.waitBallsArray = new Array(); this.ballsArray = new Array(); this.rowsY = new Array(); this.rowsIsOffSet = new Array(); this.collumnsX = new Array(); this.rowsArray = new Array(); this.floorX = new Array(); var i = 0; while(i <= this.numRows) { this.rowsArray[i] = new Array(); this.rowsY[i] = this.ballSize / 2 + (i + 2) * (this.ballSize * 0.87); i++; } var i = 0; while(i < this.numCollumns) { this.collumnsX[i] = this.ballSize / 2 + this.ballSize / 2 * i; this.rowsArray[this.numRows][i] = "floor"; if(i % 2 == 0) { this.floorX[i] = this.collumnsX[i]; } i++; } this.floorY = floorY = this.ballSize + this.ballSize * 0.87 * (this.numRows + 1); this.mc.wdth = screenWidth = this.collumnsX[this.numCollumns - 1] + this.ballSize / 2; this.mc.hgth = screenHeight = this.floorY - this.ballSize / 2 + this.ballSize * 0.13; this.bg = this.mc.attachMovie("_lscreen","screen",1); this.bg._alpha = 0; this.bg._width = this.mc.wdth; this.bg._height = this.mc.hgth; this.platform = this.mc.attachMovie("_lplatform","platform",2); this.platform._y = this.floorY - 6; } function BomberScreen(numColours, level, difficulty) { this.dinkysToHit = bomberDinkys[level]; this.timeLimit = bomberTime[level]; gui.dinkyNumbers.gotoAndStop(2); this.doDinkyNum(); this.difficulty = difficulty; this.level = level; this.ID = 200; this.ballSize = 26; this.halfBS = 13; this.rowSize = this.ballSize * 0.87; this.canGo = true; this.canGo2 = true; this.mc = createEmptyMovieClip("screen",0); this.mc._y = 40 - 2 * this.rowSize; this.mc._x = 46; this.mc.myObject = this; this.fallSpeed = 13; this.mc.wdth = screenWidth; this.mc.hgth = screenHeight; this.bg = this.mc.attachMovie("_lscreen","screen",1); this.bg._alpha = 0; this.bg._width = this.mc.wdth; this.bg._height = this.mc.hgth; this.platform = this.mc.attachMovie("_lplatform","platform",2); this.platform._y = floorY - 6; this.mdArray = new Array(); } function Ball(colour, x, wait, myScreen) { this.colour = colour; this.ballNum = 3; this.myScreen = myScreen; while(this.myScreen.ballsArray[this.ballNum].kind == "ball") { this.ballNum = this.ballNum + 1; } this.myScreen.ballsArray[this.ballNum] = this; this.mc = this.myScreen.mc.attachMovie("ball" + colour,"ball" + this.ballNum,this.ballNum); if(x < this.myScreen.ballSize / 2) { x = this.myScreen.ballSize / 2; } else if(x > this.myScreen.collumnsX[this.myScreen.numCollumns - 1]) { x = this.myScreen.collumnsX[this.myScreen.numCollumns - 1]; } if(wait) { this.mc.gotoAndStop("wait3"); this.wait = 3; this.tempColour = colour; this.tempArrayNum = 0; while(this.myScreen.waitBallsArray[this.tempArrayNum].kind == "ball") { this.tempArrayNum = this.tempArrayNum + 1; } this.myScreen.waitBallsArray[this.tempArrayNum] = this; this.colour = -1; } else { this.colour = colour; } this.x = x; this.y = this.myScreen.rowsY[this.myScreen.loseRow]; this.kind = "ball"; this.mc._x = -100; this.mc._y = this.y; this.mc.myObject = this; this.collumn = this.getCollumn(); this.row = this.myScreen.loseRow - 1; } function Bomb(power, x, myScreen) { this.myScreen = myScreen; this.mc = this.myScreen.mc.attachMovie("_lbomb","bomb",999); if(x < this.myScreen.ballSize / 2) { x = this.myScreen.ballSize / 2; } else if(x > this.myScreen.collumnsX[this.myScreen.numCollumns - 1]) { x = this.myScreen.collumnsX[this.myScreen.numCollumns - 1]; } this.power = power; this.mc.gotoAndStop(power); this.x = x; this.y = this.myScreen.rowsY[this.myScreen.loseRow]; this.mc._x = -100; this.mc._y = this.y; this.mc.myObject = this; this.collumn = this.getCollumn(); this.row = this.myScreen.loseRow - 1; } function mHead(power, x, myScreen) { this.myScreen = myScreen; this.mc = this.myScreen.mc.attachMovie("_lheadC","mHead",999); if(x < this.myScreen.ballSize / 2) { x = this.myScreen.ballSize / 2; } else if(x > this.myScreen.collumnsX[this.myScreen.numCollumns - 1]) { x = this.myScreen.collumnsX[this.myScreen.numCollumns - 1]; } this.power = power; this.x = x; this.y = this.myScreen.rowsY[this.myScreen.loseRow]; this.mc._x = -100; this.mc._y = this.y; this.mc.myObject = this; this.collumn = this.getCollumn(); this.row = this.myScreen.loseRow - 1; } function timeR(power, x, myScreen) { this.myScreen = myScreen; this.mc = this.myScreen.mc.attachMovie("_ltimeR","timeR",999); if(x < this.myScreen.ballSize / 2) { x = this.myScreen.ballSize / 2; } else if(x > this.myScreen.collumnsX[this.myScreen.numCollumns - 1]) { x = this.myScreen.collumnsX[this.myScreen.numCollumns - 1]; } this.power = power; this.x = x; this.y = this.myScreen.rowsY[this.myScreen.loseRow]; this.mc._x = -100; this.mc._y = this.y; this.mc.myObject = this; this.collumn = this.getCollumn(); this.row = this.myScreen.loseRow - 1; } function smartB(power, x, myScreen) { this.myScreen = myScreen; this.mc = this.myScreen.mc.attachMovie("_lsmartBomb","smartB",999); if(x < this.myScreen.ballSize / 2) { x = this.myScreen.ballSize / 2; } else if(x > this.myScreen.collumnsX[this.myScreen.numCollumns - 1]) { x = this.myScreen.collumnsX[this.myScreen.numCollumns - 1]; } this.power = power; this.x = x; this.y = this.myScreen.rowsY[this.myScreen.loseRow]; this.mc._x = -100; this.mc._y = this.y; this.mc.myObject = this; this.collumn = this.getCollumn(); this.row = this.myScreen.loseRow - 1; } function Missile(x, myScreen) { this.myScreen = myScreen; this.mc = this.myScreen.mc.attachMovie("_lbomb","bomb" + myScreen.ID++,2000 + myScreen.ID++); if(x < this.myScreen.ballSize / 2) { x = this.myScreen.ballSize / 2; } else if(x > this.myScreen.collumnsX[this.myScreen.numCollumns - 1]) { x = this.myScreen.collumnsX[this.myScreen.numCollumns - 1]; } this.x = x; this.fallSpeed = 20; this.y = claw._y - theScreen.mc._y; this.mc._x = -100; this.mc._y = this.y; this.mc.myObject = this; } function MiniDinky(myScreen) { this.num = 3; this.kind = "mini"; this.myScreen = myScreen; while(this.myScreen.mdArray[this.num - 3].kind == "mini") { this.num = this.num + 1; } this.myScreen.mdArray[this.num - 3] = this; this.mc = this.myScreen.mc.attachMovie("_lminiDinky","md" + this.num,this.num); this.mc.gotoAndStop(Math.ceil(Math.random() * 5)); this.mc._y = floorY - 3; this.mc.speed = 2 + Math.floor(Math.random() * 3); this.mc.myObject = this; if(Math.random() > 0.5) { this.mc._x = screenWidth + 10; this.mc.walkLeft = true; this.mc._xscale = -100; } else { this.mc._x = -10; this.mc.walkLeft = false; } this.mc.onEnterFrame = miniMove; } function timerObject(delay, action) { this.timer = createEmptyMovieClip("timerClip" + ID,ID++); this.timer.delay = delay; this.timer.action = action; this.timer.time = getTimer(); this.timer.onEnterFrame = function() { if(getTimer() - this.time > this.delay) { this.action(); this.removeMovieClip(); } }; } function greyAction() { if(this.num >= 0) { this.myScreen.ballsArray[this.num--].mc.head.gotoAndStop("grey"); } if(this.num >= 0) { this.myScreen.ballsArray[this.num--].mc.head.gotoAndStop("grey"); } if(this.num >= 0) { this.myScreen.ballsArray[this.num--].mc.head.gotoAndStop("grey"); } else { delete this.onEnterFrame; this.removeMovieClip(); } } function startScreenEnterFrame() { var myObj = this.myObject; if(this._xmouse > 0 && this._xmouse < this.wdth && this._parent._ymouse > this._y && this._parent._ymouse < this._y + this.hgth) { Mouse.hide(); } else { Mouse.show(); } var x = this._xmouse + this._x; if(x < this.myObject.halfBS + this._x) { x = this.myObject.halfBS + this._x; } else if(x > this.wdth - this.myObject.halfBS + this._x) { x = this.wdth - this.myObject.halfBS + this._x; } this._parent.claw._x = x; if(Math.random() > 0.95) { myObj.ballsArray[Math.floor(Math.random() * myObj.ballsArray.length)].mc.head.play(); } } function screenEnterFrame() { var myObj = this.myObject; if(this._xmouse > 0 && this._xmouse < this.wdth && this._parent._ymouse > this._y && this._parent._ymouse < 30 + this.hgth) { Mouse.hide(); } else { Mouse.show(); } var x = this._xmouse + this._x; if(x < this.myObject.halfBS + this._x) { x = this.myObject.halfBS + this._x; } else if(x > this.wdth - this.myObject.halfBS + this._x) { x = this.wdth - this.myObject.halfBS + this._x; } this._parent.claw._x = x; if(Math.random() > 0.95) { myObj.ballsArray[Math.floor(Math.random() * myObj.ballsArray.length)].mc.head.play(); } time = getTimer() - theScreen.startTime; if(time > myObj.timeBeforeShift) { if(this.count++ > myObj.shiftFrequency) { this.count = 0; shiftRow = true; } } if(myObj.canGo && myObj.canGo2) { gui.dropTimer.gotoAndStop(Math.ceil((time - dropTime) / 1000)); if(time - dropTime > 4000) { screenMouseDown(); gui.dropTimer.gotoAndStop(6); } } } function screenMouseDown() { var myObj = theScreen; var thisMC = theScreen.mc; var doThis = thisMC._xmouse > 0 && thisMC._xmouse < thisMC.wdth || time - dropTime > 4; if(theScreen.canGo && theScreen.canGo2 && doThis) { claw.gotoAndStop("release"); claw.colour = nextColour; gui.nextBall.gotoAndPlay("out"); theScreen.advanceBalls(); theScreen.canGo = false; theScreen.canGo2 = false; theScreen.combo = 1; if(colour < 8) { theScreen.amountOfColours[colour]++; theScreen.ballsOnScreen = theScreen.ballsOnScreen + 1; theScreen.oldBall.mc._x = theScreen.oldBall.x = claw._x - thisMC._x; theScreen.oldBall.mc._y = theScreen.oldBall.y = theScreen.rowsY[theScreen.loseRow]; theScreen.oldBall.collumn = theScreen.oldBall.getCollumn(); theScreen.oldBall.findHighestBalls(); theScreen.oldBall.mc.onEnterFrame = firstFall; delete theScreen.oldBall; } else if(colour < 10) { theBomb = theScreen.oldBall; theBomb.mc._x = theBomb.x = claw._x - thisMC._x; theBomb.mc._y = theBomb.y = theScreen.rowsY[theScreen.loseRow]; theBomb.collumn = theBomb.getCollumn(); theBomb.findHighestBalls(); theBomb.mc.onEnterFrame = bombFall; theScreen.doBonus(); } else if(colour == 10) { var rg = thisMC.attachMovie("_lrailgun","railgun",10000 + theScreen.ID++); rg.myScreen = theScreen; rg._x = thisMC._parent.claw._x - thisMC._x; rg._y = theScreen.rowsY[theScreen.loseRow]; rg.railgun.gotoAndPlay("go"); var railCol = int((rg._x - theScreen.ballSize / 2) / (theScreen.ballSize / 2)); var ballsRem = 0; var y = 0; var i = railCol - 1; while(i <= railCol + 1) { var j = 0; while(j < theScreen.numRows) { if(theScreen.rowsArray[j][i].kind == "ball") { y = theScreen.rowsArray[j][i].mc._y; theScreen.explodeBall(theScreen.rowsArray[j][i]); ballsRem++; } j++; } i++; } var scoreAdded = ballsRem * theScreen.level * theScreen.difficulty * 10; score += scoreAdded; theScreen.doScore(); var as = thisMC.attachMovie("_laddScore","aScore" + theScreen.ID,10000 + theScreen.ID++); as.scr = scoreAdded; theScreen.doScore(); as._x = rg._x; as._y = y; rgPause = function() { theScreen.ballsFall(); }; new TimerObject(500,rgPause); } else if(colour == 11) { theBomb = theScreen.oldBall; theBomb.mc._x = theBomb.x = thisMC._parent.claw._x - thisMC._x; theBomb.mc._y = theBomb.y = theScreen.rowsY[theScreen.loseRow]; theBomb.collumn = theBomb.getCollumn(); theBomb.findHighestBalls(); if(theBomb.returnObject != "floor") { theBomb.smashColour = theBomb.returnObject.colour; theBomb.mc.gotoAndStop(1 + theBomb.smashColour); } theBomb.mc.onEnterFrame = mHeadFall; theScreen.doBonus(); } else { theBomb = theScreen.oldBall; theBomb.mc._x = theBomb.x = thisMC._parent.claw._x - thisMC._x; theBomb.mc._y = theBomb.y = theScreen.rowsY[theScreen.loseRow]; theBomb.collumn = theBomb.getCollumn(); theBomb.findHighestBalls(); theBomb.mc.onEnterFrame = mHeadFall; theScreen.doBonus(); } } } function doBallThing() { fBall._x = fBall.myObject.x; fBall._y = fBall.myObject.y; fBall.myObject.whatHappens(fBall.wait); delete this.onEnterFrame; } function mHeadFall() { var hit = false; var myObj = this.myObject; myObj.y += myObj.fallSpeed; this._y = myObj.y; if(++myObj.fallCount >= myObj.fallFrames) { this.gotoAndPlay("destroy"); myObj.row = myObj.returnRow; this._y = theScreen.rowsY[myObj.row]; delete this.onEnterFrame; } } function bombFall() { var hit = false; var myObj = this.myObject; myObj.y += myObj.fallSpeed; this._y = myObj.y; if(++myObj.fallCount >= myObj.fallFrames) { myObj.row = myObj.returnRow; this._y = theScreen.rowsY[myObj.row]; myObj.explode(myObj.power); this.gotoAndPlay("fire"); delete this.onEnterFrame; } } function firstFall() { var hit = false; var myObj = this.myObject; myObj.y += myObj.fallSpeed; if(++myObj.fallCount >= myObj.fallFrames) { myObj.row = myObj.returnRow; this._y = theScreen.rowsY[myObj.row]; delete myObj.fallCount; delete myObj.fallFrames; delete myObj.fallSpeed; myObj.whatHappens(false); this._parent._parent.doTinkSound(); delete this.onEnterFrame; } else { this._y = myObj.y; } } function dostars(b) { b.numStars = 3; var i = 0; while(i < b.numStars) { var st = b.star.duplicateMovieClip("star" + i,i); st.xSpeed = Math.random() * 20 - 10; st.ySpeed = Math.random() * 3 - 8; st.rotate = Math.random() * 10 - 20; st.scaleChange = 3; st.isStar = true; st.num = i; 60 + Math.random() * 40; st.gotoAndStop(Math.ceil(Math.random() * 2)); st.onEnterFrame = function() { if(this.isStar) { this._xscale -= this.scaleChange; this._yscale -= this.scaleChange; this._x += this.xSpeed; this._y += this.ySpeed; this._rotation += this.rotate; this.ySpeed += 0.5; } }; i++; } var sh = new Sound(b); sh.attachSound("_lshatter" + Math.ceil(Math.random() * 4)); sh.start(); b.star._visible = false; } function doAvatar(move) { if(move == "gameOver") { avatarFree = false; gui.avatar.gotoAndStop("blowUp"); } else if(avatarFree) { avatarFree = false; gui.avatar.gotoAndStop(move); } } function doTinkSound() { var tk = new Sound(); tk.attachSound("_ltink" + Math.ceil(Math.random() * 2)); tk.start(); } function nextLevel() { removeIntervals(); theScreen.mc.removeMovieClip(); delete theScreen; delete theBomb; delete rg; if(levelDescr[level] == "bomber") { theScreen = new BomberScreen(8,level,difficulty); } else { isPattern = levelDescr[level] == "pattern"; theScreen = new Screen(8,level,difficulty); } theScreen.startGame(); } function initialiseGame(d, p) { gameStarted = false; gui.avatar.gotoAndStop(1); gui.nextBall.gotoAndStop(16); difficulty = d; level = 1; tempScore = 0; score = 0; bonusLev = 1; bonusLevel = -1; gui.dinkyNumbers.gotoAndStop(1); scoresArray = new Array(0,0,0,0,0,0,0); var i = 0; while(i < 7) { gui["score" + i].gotoAndStop(1); i++; } players = p; nextLevel(); theScreen.doScore(); theScreen.doBonus(); } function removeIntervals() { clearInterval(checkPause); clearInterval(bombPause); clearInterval(pause); clearInterval(abfpause); clearInterval(rgPause); clearInterval(specialPause); clearInterval(CCpause); } function resetGame() { level = 1; score = 0; bonusLev = 1; bonusLevel = -1; gui.menuButton._visible = false; gui.resetButton._visible = false; delete theBomb; instructions.gotoAndStop(1); instructions._visible = false; floor = "floor"; removeIntervals(); theScreen.mc.removeMovieClip(); delete theScreen; gui.miniDinkyTimer.gotoAndStop(1); gui.dinkyNumbers.gotoAndStop(1); gui.bonusSlider.gotoAndStop(1); gui.bonus.gotoAndStop(1); if(gui.dropTimerCover._currentFrame != 1) { gui.dropTimerCover.gotoAndPlay("close"); } gui.bonusBar.gotoAndStop(1); gui.bonusStars.gotoAndStop(1); gui.doors.gotoAndPlay("iClose"); gui.doors.tDoor.gotoAndStop(1); gui.doors.bDoor.gotoAndStop(1); Mouse.show(); Key.removeListener(myListener); } function startGame() { resetGame(); gui.resetButton._visible = true; initialiseGame(1,1); } function bScreenEnterFrame() { var myObj = this.myObject; if(this._xmouse > 0 && this._xmouse < this.wdth && this._parent._ymouse > this._y && this._parent._ymouse < 30 + this.hgth) { Mouse.hide(); } else { Mouse.show(); } var x = this._xmouse + this._x; if(x < this.myObject.halfBS + this._x) { x = this.myObject.halfBS + this._x; } else if(x > this.wdth - this.myObject.halfBS + this._x) { x = this.wdth - this.myObject.halfBS + this._x; } this._parent.claw._x = x; time = getTimer() - myObj.startTime; if(myObj.canGo && myObj.canGo2) { gui.dropTimer.gotoAndStop(Math.ceil((time - dropTime) / 1000)); if(time - dropTime > 4000) { bScreenMouseDown(); gui.dropTimer.gotoAndStop(6); } } if(this.mdCount++ > 15) { var md = new MiniDinky(myObj); this.mdCount = Math.ceil(Math.random() * 10); } if(time < myObj.timeLimit) { gui.miniDinkyTimer.gotoAndStop(Math.ceil(2 + 100 / myObj.timeLimit * time)); } } function bScreenMouseDown() { var myObj = theScreen; var thisMC = theScreen.mc; var doThis = thisMC._xmouse > 0 && thisMC._xmouse < thisMC.wdth || time - dropTime > 4; if(myObj.canGo && myObj.canGo2 && doThis) { claw.gotoAndStop("release"); claw.colour = nextColour; gui.nextBall.gotoAndPlay("out"); theScreen.canGo = false; theScreen.canGo2 = false; theScreen.combo = 1; if(colour < 10) { theBomb = theScreen.oldBall; theBomb.mc._x = theBomb.x = claw._x - thisMC._x; theBomb.mc.onEnterFrame = missileFall; } var sh = new Sound(this); sh.attachSound("_lfall"); sh.start(); } } function missileFall() { var myObj = this.myObject; myObj.y += myObj.fallSpeed; this._y = myObj.y; if(this._y >= screenHeight) { this._y = screenHeight; delete this.onEnterFrame; myObj.explode(); this.gotoAndPlay("fire"); } } function miniMove() { if(this.walkLeft) { this._x -= this.speed; } else { this._x += this.speed; } if(Math.random() > 0.99) { this.walkLeft = !this.walkLeft; this.mc._xscale *= -1; } if(this._x > screenWidth + 25 || this._x < -25) { theScreen.removeMini(this.myObject); this.removeMovieClip(); } } function miniFly() { this._x += this.xSpeed; this._y += this.ySpeed; this._rotation += this.rotate; this.ySpeed += 0.8; if(this._y >= screenHeight && this.ySpeed > 0) { if(this.ySpeed < 2) { this.stopped = true; } this.ySpeed *= -0.5; } if(this.stopped) { this._alpha -= 10; } if(this._x < -10 || this._x > screenWidth || this._alpha < 20) { theScreen.removeMini(this.myObject); this.removeMovieClip(); } } function instrDropBall() { var myObj = theScreen; var thisMC = theScreen.mc; claw.gotoAndStop("release"); claw.colour = nextColour; gui.nextBall.gotoAndPlay("out"); theScreen.combo = 1; if(colour < 8) { theScreen.oldBall.mc._x = theScreen.oldBall.x = claw._x - thisMC._x; theScreen.oldBall.mc._y = theScreen.oldBall.y = theScreen.rowsY[theScreen.loseRow]; theScreen.oldBall.collumn = theScreen.oldBall.getCollumn(); theScreen.oldBall.findHighestBalls(); theScreen.oldBall.mc.onEnterFrame = firstFall; delete theScreen.oldBall; } else { theBomb = theScreen.oldBall; theBomb.mc._x = theBomb.x = claw._x - thisMC._x; theBomb.mc._y = theBomb.y = theScreen.rowsY[theScreen.loseRow]; theBomb.collumn = theBomb.getCollumn(); theBomb.findHighestBalls(); theBomb.mc.onEnterFrame = bombFall; theScreen.doBonus(); } } function instructionMissile() { gui.bonusSlider.bonusI.gotoAndStop(bonusLevel); gui.bonusSlider.gotoAndPlay(2); var ob = theScreen.oldBall; ob.mc._x = ob.x = claw._x - theScreen.mc._x; ob.mc._y = ob.y = theScreen.rowsY[theScreen.loseRow]; delete theScreen.ballsArray[ob.ballNum]; ob.mc.gotoAndPlay(2); delete ob; colour = bonusLevel + 7; claw.colour = colour; claw.gotoAndPlay(1); theScreen.oldBall = new Bomb(colour - 7,-100,theScreen); bonusLev = 1; gui.bonus.gotoAndStop(1); theScreen.doBonus(); } function removeInstructions() { delete theBomb; theScreen.mc.removeMovieClip(); delete theScreen; instructions._visible = false; } function doInstructions() { if(doneInstructionsOnce) { gui.menuButton._visible = true; instructions._visible = true; isPattern = true; theScreen = new InstructionScreen(8,999,1); theScreen.populate(4,8); } else { theScreen = new InstructionScreen(8,999,1); theScreen.populate(4,8); } } Function.prototype.extend = function(superClass) { this.prototype.__proto__ = superClass.prototype; this.prototype.__constructor__ = superClass; ASSetPropFlags(this.prototype,["__constructor__"],1); }; ASSetPropFlags(Function.prototype,["extend"],1); InstructionScreen.extend(Screen); BomberScreen.extend(Screen); Bomb.extend(Ball); mHead.extend(Ball); timeR.extend(Ball); smartB.extend(Ball); Screen.prototype.advanceBalls = function() { var wba = this.waitBallsArray; var i = 0; while(i < wba.length) { wba[i].wait--; wba[i].mc.gotoAndStop("wait" + wba[i].wait); if(wba[i].wait <= 0) { wba[i].colour = wba[i].tempColour; wba[i].mc.gotoAndStop(1); delete wba[i]; } i++; } }; Screen.prototype.populate = function(rows, nColours) { var i = 0; while(i < 10) { this.amountOfColours[i] = 0; i++; } this.ballsOnScreen = 0; if(isPattern) { patternArray = new Array(); var i = 0; while(i < this.numRows) { patternArray[i] = new Array(); var j = 0; while(j < this.numCollumns) { var bit = levelMap[this.level][j + i * this.numCollumns]; if(bit != null) { patternArray[i][j] = int(bit); } else { patternArray[i][j] = null; } j++; } i++; } populator.colour = ballsPattern[this.level][this.numRows - 1][0]; this.patternPopulateAction(); } else { this.populateAction(nColours,this.numRows - rows - 1); } }; Screen.prototype.populated = function() { if(levelRandBall[this.level][this.ballCount] == undefined) { colour = Math.floor(Math.random() * this.numColours); while(this.amountOfColours[colour] == 0) { colour = int(Math.random() * this.numColours); } nextColour = Math.floor(Math.random() * this.numColours); while(this.amountOfColours[nextColour] == 0) { nextColour = int(Math.random() * this.numColours); } } else { colour = levelRandBall[this.level][this.ballCount++]; nextColour = levelRandBall[this.level][this.ballCount++]; } claw.colour = colour; this.oldBall = new Ball(colour,-100,false,this); gui.nextBall.colour = nextColour + 1; gui.nextBall.gotoAndPlay(1); this.canGo = true; this.startTime = getTimer(); if(gameStarted) { gui.doors.gotoAndPlay("open"); } else { gameStarted = true; gui.doors.gotoAndPlay(2); } gui.dropTimerCover.gotoAndPlay("open"); this.dialogue.gotoAndPlay("out"); claw.gotoAndPlay(1); theScreen.mc.onEnterFrame = screenEnterFrame; theScreen.mc.onMouseDown = screenMouseDown; }; screen.prototype.patternPopulateAction = function() { var i = 0; while(i < this.numRows) { var j = 0; while(j < this.numCollumns) { var colourT = patternArray[i][j]; if(colourT == 8) { colourT = -99; } if(colourT != null && colourT != undefined) { if(colourT >= 0) { this.amountOfColours[colourT]++; this.ballsOnScreen = this.ballsOnScreen + 1; } var newBall = new Ball(colourT,0,false,this); newBall.row = i + 1; newBall.collumn = j; newBall.x = newBall.mc._x = this.collumnsX[j]; newBall.y = newBall.mc._y = this.rowsY[i + 1]; this.rowsArray[i + 1][j] = newBall; } j++; } i++; } this.populated(); }; Screen.prototype.populateAction = function(nColours, lastRow) { var rowT = this.numRows - 1; var collumnT = 0; var colourT = level % nColours; while(rowT > lastRow) { if(collumnT < this.numCollumns) { if(++colourT == nColours) { colourT = 0; } this.amountOfColours[colourT]++; this.ballsOnScreen = this.ballsOnScreen + 1; var newBall = new Ball(colourT,0,false,this); newBall.row = rowT; newBall.collumn = collumnT; newBall.x = newBall.mc._x = this.collumnsX[collumnT]; newBall.y = newBall.mc._y = this.rowsY[rowT]; this.rowsArray[rowT][collumnT] = newBall; collumnT += 2; } else { rowT--; if((this.numRows - rowT) % 2 == 1) { collumnT = 0; } else { collumnT = 1; } } } this.populated(); }; Screen.prototype.addEballs = function(pattern, balls) { var i = 0; while(i < balls.length) { i++; } }; Screen.prototype.shiftRows = function() { this.loseRow = this.loseRow + 1; this.mc._y -= this.rowSize; this.dialogue._y += this.rowSize; var sh = new Sound(this.platform); sh.attachSound("_lshiftRow"); sh.start(); doAvatar("hanghead"); }; Screen.prototype.ballsFall = function() { this.combo = this.combo + 1; var i = 0; while(i < this.ballsArray.length) { this.ballsArray[i].fallen = false; i++; } this.row = this.numRows - 2; this.collumn = 0; this.ballsChanged = false; this.allBallsFall(); }; Screen.prototype.allBallsFall = function() { var startRow = this.row; var b; var processed = false; while(b = this.rowsArray[this.row][this.collumn].kind != "ball" || b.fallen) { if(this.collumn >= this.numCollumns) { if(this.row < 0 || this.row + 1 < startRow) { if(this.ballsChanged) { var abfpause = function() { theScreen.colourCheck(); }; new TimerObject(135,abfpause); } else { this.nextGo(); } return undefined; } this.row--; this.collumn = 0; } else { this.collumn = this.collumn + 1; } } if(!b.fallen) { b.fallen = true; b.popFall(); } }; Screen.prototype.colourCheck = function() { var i = 0; while(i < this.ballsArray.length) { this.ballsArray[i].checked = false; this.ballsArray[i].chainCounted = false; i++; } var i = 0; while(i < this.ballsArray.length) { if(!this.ballsArray[i].checked && this.ballsArray[i].colour >= 0) { this.ballsArray[i].ballColourCheck(); } i++; } var thereAreChains = false; var i = 0; while(i < this.ballsArray.length) { var b = this.ballsArray[i]; if(b.chain.length > 2) { if(!b.chainCounted) { var comBall = b; var scoreAdded = Math.ceil(b.chain.length * this.combo * this.level * this.difficulty) * 10; score += scoreAdded; this.doScore(); if(this.combo > 1) { bonusLev += (this.combo - 1) * b.chain.length * 2; var k = 0; while(k < 5) { var st = this.mc.attachMovie("_lstar","star" + this.ID,10000 + this.ID++); st.ySpeed = -5 - Math.random() * 5; st.xSpeed = 1 - Math.random() * 20; st._x = b.mc._x; st._y = b.mc._y; st._xscale = st.yscale = 50 * Math.ceil(Math.random() * 2); st.onEnterFrame = function() { if(this._x > screenWidth + 30 || this._y > screenHeight + 30) { theScreen.doBonus(); this._parent._parent.gui.bonusBar.flash.gotoAndPlay(2); this._parent._parent.gui.bonusStars.flash.gotoAndPlay(2); this.removeMovieClip(); } else { this._x += this.xSpeed; this._y += this.ySpeed; this.xSpeed += (screenWidth - this._x) / 40; this.ySpeed += (screenHeight - this._y) / 40; } }; k++; } } var as = this.mc.attachMovie("_laddScore","aScore" + this.ID,10000 + this.ID++); as.scr = scoreAdded; as._x = b.mc._x; as._y = b.mc._y; } var j = 0; while(j < b.chain.length) { b.chain[j].chainCounted = true; j++; } this.explodeBall(b); thereAreChains = true; } i++; } if(thereAreChains) { if(this.combo > 1) { var ch = new Sound(this.mc); ch.attachSound("_lchord" + (this.combo - 1) % 5); ch.start(); doAvatar("jump"); } var CCpause = function() { theScreen.ballsFall(); }; new TimerObject(500,CCpause); } else { this.nextGo(); } }; Screen.prototype.explodeBall = function(b) { if(b.colour >= 0) { this.amountOfColours[b.colour]--; this.ballsOnScreen--; } delete this.rowsArray[b.row][b.collumn]; delete this.ballsArray[b.ballNum]; b.mc.gotoAndPlay(2); delete b; }; Screen.prototype.nextGo = function() { if(this.ballsOnScreen > 0) { colour = nextColour; if(colour < 8) { this.oldBall = new Ball(colour,-100,false,this); } else if(colour < 10) { this.oldBall = new Bomb(colour - 7,-100,this); } else if(colour == 11) { this.oldBall = new mHead(colour - 7,-100,this); } if(levelRandBall[this.level][this.ballCount] == undefined) { nextColour = Math.floor(Math.random() * this.numColours); if(this.ballsOnScreen < this.stopVar) { while(this.amountOfColours[nextColour] == 0) { nextColour = int(Math.random() * this.numColours); } } } else { nextColour = levelRandBall[level][this.ballcount++]; } gui.nextBall.colour = nextColour + 1; if(gui.nextBall._currentFrame == 18) { gui.nextBall.gotoAndPlay(1); } else { gui.nextBall.go = true; } gui.dropTimer.gotoAndStop(1); if(shiftRow) { shiftRow = false; this.shiftRows(); } } else { this.levelCleared(); } }; Screen.prototype.levelCleared = function() { Mouse.show(); Key.removeListener(myListener); delete theScreen.mc.onMouseDown; delete theScreen.mc.onEnterFrame; claw.gotoAndStop(1); gui.dropTimerCover.gotoAndPlay("lclose"); gui.doors.gotoAndPlay("close"); gui.doors.action = "levelCleared"; if(players == 1) { var addScore = 0; var levTime = 120000 + level * 5; if(time < levTime) { addScore = int((levTime - time) / 1000) * this.difficulty * this.level * 10; } score += addScore; gui.doors.addScore = addScore; level++; } doAvatar("jump"); }; Screen.prototype.gameOver = function() { doAvatar("gameOver"); gui.dialogue.gotoAndPlay("go"); Mouse.show(); delete this.mc.onMouseDown; delete this.mc.onEnterFrame; claw.gotoAndStop("release"); gui.nextBall.gotoAndStop(16); var greyer = this.mc.createEmptyMovieClip("greyerMC",19929293); greyer.myScreen = this; greyer.num = this.ballsArray.length; greyer.onEnterFrame = greyAction; tempScore = score; }; Screen.prototype.startGame = function() { shiftRow = false; bg.gotoAndStop(level % 10 + 1); claw.myScreen = this; this.dialogue.txt.txt = "LEVEL " + this.level; this.dialogue.gotoAndPlay("go"); this.timeBeforeShift = 45000 - 1000 * (this.level / 2); this.shiftFrequency = 310 - 5 * this.level; this.stopVar = 40 - this.level; if(this.stopVar < 1) { this.stopVar = 1; } var startRows = 4 + Math.ceil(this.level / 5); this.populate(startRows,8); Key.addListener(myListener); }; screen.prototype.railgunFin = function() { this.ballsFall(); this.mc.railgun.removeMovieClip(); }; screen.prototype.doScore = function() { if(gameStarted) { var i = 0; while(i < 7) { if(score < Math.pow(10,i)) { var num = 0; } else { var num = Math.floor(score % Math.pow(10,i + 1) / Math.pow(10,i)); } if(scoresArray[i] != num) { scoresArray[i] = num; gui["score" + i].num = num; gui["score" + i].play(); } i++; } } }; screen.prototype.doBonus = function() { if(bonusLevel != Math.Floor(bonusLev / 20)) { bonusLevel = Math.Floor(bonusLev / 20); if(bonusLevel == 0) { gui.bonus.gotoAndStop(1); } else { gui.bonus.bonusLevel = bonusLevel; gui.bonus.gotoAndPlay("open"); gui.bonus.bonusT.gotoAndStop(bonusLevel); gui.bonus.bonusI.gotoAndStop(bonusLevel); } } if(bonusLev < 121) { gui.bonusBar.gotoAndStop(bonusLev); gui.bonusStars.gotoAndStop(Math.Floor(bonusLev / 20) + 1); } else { bonusLevel = 6; gui.bonusBar.gotoAndStop(120); gui.bonusStars.gotoAndStop(7); } }; myListener = new Object(); myListener.onKeyDown = function() { k = Key.getCode(); if(k == 32 && theScreen.canGo && theScreen.canGo2 && bonusLevel > 0) { gui.bonusSlider.bonusI.gotoAndStop(bonusLevel); gui.bonusSlider.gotoAndPlay(2); theScreen.canGo2 = false; var ob = theScreen.oldBall; ob.mc._x = ob.x = claw._x - theScreen.mc._x; ob.mc._y = ob.y = theScreen.rowsY[theScreen.loseRow]; delete theScreen.ballsArray[ob.ballNum]; ob.mc.gotoAndPlay(2); delete ob; colour = bonusLevel + 7; claw.colour = colour; claw.gotoAndPlay(1); if(colour < 10) { theScreen.oldBall = new Bomb(colour - 7,-100,theScreen); } else if(colour == 11) { theScreen.oldBall = new mHead(colour - 7,-100,theScreen); } else if(colour == 12) { theScreen.oldBall = new timeR(colour - 7,-100,theScreen); } else if(colour == 13) { theScreen.oldBall = new smartB(colour - 7,-100,theScreen); } dropTime = time; bonusLev = 1; gui.bonus.gotoAndStop(1); theScreen.doBonus(); } }; Ball.prototype.findHighestBalls = function() { this.returnRow = this.myScreen.numRows - 1; var returnObject = "floor"; var r; if(this.collumn > 0) { var i = this.row + 1; while(r = this.myScreen.rowsArray[i][this.collumn - 1].kind != "ball" && i < this.myScreen.numRows) { i++; } if(r.row - 1 < this.returnRow && r.kind == "ball") { returnObject = r; this.returnRow = r.row - 1; } } if(this.collumn < this.myScreen.numCollumns) { var i = this.row + 1; while(r = this.myScreen.rowsArray[i][this.collumn + 1].kind != "ball" && i < this.myScreen.numRows) { i++; } if(r.row - 1 < this.returnRow && r.kind == "ball") { returnObject = r; this.returnRow = r.row - 1; } } var i = this.row + 1; while(r = this.myScreen.rowsArray[i][this.collumn].kind != "ball" && i < this.myScreen.numRows) { i++; } if(r.row - 1 <= this.returnRow && r.kind == "ball") { returnObject = r; this.returnRow = r.row - 1; } if(returnObject != "floor") { this.destY = returnObject.y - Math.sqrt(Math.pow(this.myScreen.ballSize,2) - Math.pow(this.x - returnObject.x,2)) - this.myScreen.rowsY[this.myScreen.loseRow - 1]; this.fallSpeed = this.destY / (returnObject.row - this.myScreen.loseRow - 1); } else { this.destY = this.myScreen.rowsY[this.myScreen.numRows] - this.myScreen.rowsY[this.myScreen.loseRow - 1]; this.fallSpeed = this.destY / (this.myScreen.numRows - this.myScreen.loseRow - 1); } this.fallCount = 1; this.fallFrames = Math.floor(this.destY / this.fallSpeed); trace("this.destY " + this.destY + ", this.returnRow " + this.returnRow + ", this.row " + this.row + ", this.fallSpeed " + this.fallSpeed); if(returnObject == undefined) { score = 666; theScreen.doScore(); } }; Ball.prototype.whatHappens = function(wait) { var rowBelow = this.myScreen.rowsArray[this.row + 1]; if(rowBelow[this.collumn] == "floor") { if(this.myScreen.floorX[this.collumn] == undefined) { var randomThang = Math.random(); if(this.x < this.myScreen.collumnsX[this.collumn] || this.collumn == this.myScreen.numCollumns - 1) { randomThang = 0; } if(this.x > this.myScreen.collumnsX[this.collumn]) { randomThang = 1; } if(randomThang > 0.5) { this.collumn = this.collumn + 1; } else { this.collumn--; } } this.x = this.mc._x = this.myScreen.collumnsX[this.collumn]; this.y = this.mc._y = this.myScreen.rowsY[this.row]; this.myScreen.rowsArray[this.row][this.collumn] = this; if(this.row < this.myScreen.loseRow) { this.myScreen.gameOver(); } else if(!wait) { var checkPause = function() { theScreen.colourCheck(); }; new TimerObject(200,checkPause); } else { this.myScreen.allBallsFall(); } } else if(rowBelow[this.collumn].kind == "ball") { this.myScreen.ballsChanged = true; var rand = Math.random(); if(this.x > this.myScreen.collumnsX[this.collumn]) { rand = 0; } else if(this.x < this.myScreen.collumnsX[this.collumn]) { rand = 1; } else if(rowBelow[this.collumn - 2].kind != "ball" || this.myScreen.rowsArray[this.row - 1][this.collumn + 2].kind == "ball") { rand = 1; } else if(rowBelow[this.collumn + 2].kind != "ball" || this.myScreen.rowsArray[this.row - 1][this.collumn - 2].kind == "ball") { rand = 0; } if(this.collumn == 0) { rand = 0; } else if(this.collumn == this.myScreen.numCollumns - 1) { rand = 1; } if(rand < 0.5) { this.y = this.mc._y = this.myScreen.rowsY[this.row]; this.x = this.mc._x = this.myScreen.collumnsX[this.collumn++]; this.whatHappens(wait); } else { this.y = this.mc._y = this.myScreen.rowsY[this.row]; this.x = this.mc._x = this.myScreen.collumnsX[this.collumn--]; this.whatHappens(wait); } doTinkSound(); } else if(rowBelow[this.collumn - 1].kind == "ball" && rowBelow[this.collumn + 1].kind == "ball") { this.x = this.mc._x = this.myScreen.collumnsX[this.collumn]; this.y = this.mc._y = this.myScreen.rowsY[this.row]; this.myScreen.rowsArray[this.row][this.collumn] = this; if(this.row < this.myScreen.loseRow) { this.myScreen.gameOver(); } else if(!wait) { var checkPause = function() { theScreen.colourCheck(); }; new TimerObject(200,checkPause); } else { this.myScreen.allBallsFall(); } } else if(rowBelow[this.collumn - 1].kind == "ball") { if(this.collumn >= this.myScreen.numCollumns - 1) { this.x = this.mc._x = this.myScreen.collumnsX[this.collumn]; this.y = this.mc._y = this.myScreen.rowsY[this.row]; this.myScreen.rowsArray[this.row][this.collumn] = this; if(this.row < this.myScreen.loseRow) { this.myScreen.gameOver(); } else if(!wait) { var checkPause = function() { theScreen.colourCheck(); }; new TimerObject(200,checkPause); } else { this.myScreen.allBallsFall(); } } else { this.myScreen.ballsChanged = true; this.x = Number(this.myScreen.collumnsX[++this.collumn]); this.y = Number(this.myScreen.rowsY[++this.row]); this.mc.wait = wait; fBall = this.mc; ballPause = setInterval(function() { clearInterval(ballPause); fBall._x = fBall.myObject.x; fBall._y = fBall.myObject.y; fBall.myObject.whatHappens(fBall.wait); } ,30); doTinkSound(); } } else if(rowBelow[this.collumn + 1].kind == "ball") { if(this.collumn == 0) { this.x = this.mc._x = this.myScreen.collumnsX[this.collumn]; this.y = this.mc._y = this.myScreen.rowsY[this.row]; this.myScreen.rowsArray[this.row][this.collumn] = this; if(this.row < this.myScreen.loseRow) { this.myScreen.gameOver(); } else if(!wait) { var checkPause = function() { theScreen.colourCheck(); }; new TimerObject(200,checkPause); } else { this.myScreen.allBallsFall(); } } else { this.myScreen.ballsChanged = true; this.x = this.myScreen.collumnsX[--this.collumn]; this.y = this.myScreen.rowsY[++this.row]; this.mc.wait = wait; fBall = this.mc; ballPause = setInterval(function() { clearInterval(ballPause); fBall._x = fBall.myObject.x; fBall._y = fBall.myObject.y; fBall.myObject.whatHappens(fBall.wait); } ,30); doTinkSound(); } } else { this.findHighestBalls(); delete this.myScreen.rowsArray[this.row][this.collumn]; this.row = this.returnRow; this.mc._y = this.myScreen.rowsY[this.row]; this.whatHappens(wait); } }; Ball.prototype.popFall = function() { this.findHighestBalls(); if(this.returnRow != this.row) { this.myScreen.ballsChanged = true; doTinkSound(); } delete this.myScreen.rowsArray[this.row][this.collumn]; this.row = this.returnRow; this.mc._y = this.myScreen.rowsY[this.row]; delete this.returnRow; this.whatHappens(true); }; Ball.prototype.ballColourCheck = function() { if(!this.checked) { this.chain = new Array(); this.chain.push(this); this.checked = true; } var b; if(b = this.myScreen.rowsArray[this.row][this.collumn - 2].colour == this.colour) { this.addBall(b); } if(b = this.myScreen.rowsArray[this.row][this.collumn + 2].colour == this.colour) { this.addBall(b); } if(b = this.myScreen.rowsArray[this.row - 1][this.collumn - 1].colour == this.colour) { this.addBall(b); } if(b = this.myScreen.rowsArray[this.row - 1][this.collumn + 1].colour == this.colour) { this.addBall(b); } if(b = this.myScreen.rowsArray[this.row + 1][this.collumn - 1].colour == this.colour) { this.addBall(b); } if(b = this.myScreen.rowsArray[this.row + 1][this.collumn + 1].colour == this.colour) { this.addBall(b); } }; Ball.prototype.addBall = function(b) { if(!b.checked) { this.chain.push(b); b.checked = true; b.chain = this.chain; b.ballColourCheck(); } }; Ball.prototype.toString = function() { return this.colour + ", colour"; }; Ball.prototype.getRow = function() { return Math.floor((this.y - this.myScreen.ballSize / 2) / (this.myScreen.ballSize * 0.87)); }; Ball.prototype.getCollumn = function() { return int((this.x - this.myScreen.ballSize / 2) / (this.myScreen.ballSize / 2)); }; Bomb.prototype.explode = function(power) { var ballsRem; var i = this.row - power; while(i <= this.row + power) { var j = this.collumn - (power + 1); while(j <= this.collumn + (power + 1)) { if(this.myScreen.rowsArray[i][j].kind == "ball") { this.myScreen.explodeBall(this.myScreen.rowsArray[i][j]); ballsRem++; } j++; } i++; } var scoreAdded = ballsRem * this.myScreen.level * this.myScreen.difficulty * 10; score += scoreAdded; this.myScreen.doScore(); var as = this.myScreen.mc.attachMovie("_laddScore","aScore" + this.myScreen.ID,10000 + this.myScreen.ID++); as.scr = scoreAdded; as._x = this.x; as._y = this.y; var bombPause = function() { theScreen.ballsFall(); delete theBomb; }; new TimerObject(500,bombPause); doAvatar("missile"); }; mHead.prototype.explode = function() { var tempCol = new Array(); var ballsRem = 0; var i = 0; while(i < theScreen.amountOfColours.length) { if(theScreen.amountOfColours[i] < 10) { var an = "00" + theScreen.amountOfColours[i]; } else if(theScreen.amountOfColours[i] < 100) { var an = "0" + theScreen.amountOfColours[i]; } else { var an = "" + theScreen.amountOfColours[i]; } tempCol[i] = {colour:i,number:an}; i++; } tempCol.sortOn("number"); var i = 0; while(i < theScreen.ballsArray.length) { if(theScreen.ballsArray[i].colour == tempCol[theScreen.amountOfColours.length - 1].colour || theScreen.ballsArray[i].colour == this.smashColour) { theScreen.explodeBall(theScreen.ballsArray[i]); ballsRem++; } i++; } var scoreAdded = ballsRem * theScreen.level * theScreen.difficulty * 10; score += scoreAdded; var as = theScreen.mc.attachMovie("_laddScore","aScore" + theScreen.ID,10000 + theScreen.ID++); as.scr = scoreAdded; theScreen.doScore(); as._x = screenWidth / 2; as._y = screenHeight * 0.75; var bombPause = function() { theScreen.ballsFall(); delete theBomb; }; new TimerObject(500,bombPause); }; timeR.prototype.explode = function() { timeRPause(); }; timeRPause = function() { if(theScreen.loseRow > 2) { theScreen.loseRow--; theScreen.mc._y += theScreen.rowSize; theScreen.dialogue._y -= theScreen.rowSize; new TimerObject(500,timeRPause); } else { delete timeRCount; theScreen.startTime = getTimer(); time = dropTime = 0; delete theBomb; theScreen.nextGo(); } }; smartB.prototype.explode = function() { var ballsRem = 0; var i = 0; while(i < theScreen.ballsArray.length) { theScreen.explodeBall(theScreen.ballsArray[i]); ballsRem++; i++; } var scoreAdded = ballsRem * theScreen.level * theScreen.difficulty * 10; score += scoreAdded; var as = theScreen.mc.attachMovie("_laddScore","aScore" + theScreen.ID,10000 + theScreen.ID++); as.scr = scoreAdded; theScreen.doScore(); as._x = screenWidth / 2; as._y = screenHeight * 0.75; var smartBPause = function() { delete theBomb; theScreen.nextGo(); }; new TimerObject(2000,smartBPause); }; gui.swapDepths(1002); claw = attachMovie("_lclaw","theClaw",1000); claw._y = 100; claw.gotoAndStop("release"); railgun.swapDepths(1001); gui.menuButton._visible = false; gui.resetButton._visible = false; levelDescr = new Array(); levelDescr[3] = "pattern"; levelDescr[4] = "bomber"; levelDescr[10] = "pattern"; levelDescr[8] = "pattern"; levelDescr[13] = "pattern"; levelDescr[14] = "bomber"; levelDescr[999] = "pattern"; bomberDinkys = new Array(); bomberTime = new Array(); bomberDinkys[4] = 20; bomberDinkys[14] = 30; bomberDinkys[20] = 40; bomberTime[4] = 30000; bomberTime[14] = 40000; bomberTime[20] = 50000; levelRandBall = new Array(); levelRandBall[10] = new Array(0,4,0,4,0,4); levelRandBall[999] = new Array(0,1,4,5,4,5); levelMap = new Array(); levelMap[3] = new Array(null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,8,null,8,null,null,null,null,null,null,null,8,null,8,null,null,0,null,0,null,null,null,null,null,0,null,0,null,7,5,null,5,null,6,null,7,null,7,null,5,null,5,null,null,3,null,3,null,6,null,1,null,0,null,2,null,2,0,null,5,null,5,null,1,null,6,null,4,null,4,null,floor,floor,floor,floor,floor,floor,floor,floor,floor,floor,floor,floor,floor,floor); levelMap[10] = new Array(null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,1,null,null,null,null,null,null,null,null,null,null,0,null,4,null,5,null,3,null,2,null,4,null,5,null,null,0,null,4,null,7,null,3,null,6,null,0,null,5,4,null,5,null,5,null,7,null,2,null,2,null,0,null,null,7,null,7,null,3,null,0,null,0,null,5,null,5,1,null,1,null,3,null,6,null,6,null,4,null,4,null,floor,floor,floor,floor,floor,floor,floor,floor,floor,floor,floor,floor,floor,floor); levelMap[8] = new Array(null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,7,null,0,null,2,null,4,null,0,null,0,null,6,3,null,0,null,7,null,7,null,2,null,1,null,1,null,null,3,null,-99,null,-99,null,-99,null,-99,null,-99,null,-99,6,null,6,null,5,null,5,null,4,null,4,null,2,null,floor,floor,floor,floor,floor,floor,floor,floor,floor,floor,floor,floor,floor,floor); levelMap[13] = new Array(null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,2,null,6,null,4,null,-99,null,4,null,5,null,0,null,null,5,null,1,null,-99,null,-99,null,3,null,2,null,7,6,null,3,null,-99,null,-99,null,-99,null,6,null,4,null,null,0,null,-99,null,-99,null,-99,null,-99,null,5,null,1,0,null,-99,null,-99,null,-99,null,-99,null,-99,null,5,null,floor,floor,floor,floor,floor,floor,floor,floor,floor,floor,floor,floor,floor,floor); levelMap[999] = new Array(null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,0,null,4,null,5,null,1,null,1,null,0,null,0,7,null,3,null,4,null,5,null,2,null,7,null,6,null,null,3,null,5,null,6,null,6,null,5,null,6,null,5,7,null,7,null,3,null,4,null,4,null,2,null,2,null,floor,floor,floor,floor,floor,floor,floor,floor,floor,floor,floor,floor,floor,floor); BomberScreen.prototype.startGame = function() { bg.gotoAndStop(level % 10 + 1); colour = 8; claw.myScreen = this; claw.colour = colour; this.oldBall = new Missile(-100,this); nextColour = 8; gui.nextBall.colour = nextColour + 1; gui.nextBall.gotoAndPlay(1); this.canGo = true; this.startTime = getTimer(); gui.doors.gotoAndPlay(2); gui.dropTimerCover.gotoAndPlay("open"); claw.gotoAndPlay(1); gui.miniDinkyTimer.gotoAndStop(2); gui.hd.gotoAndPlay(2); gui.hd.hd.timeLimit.gotoAndStop("f" + this.timeLimit / 1000); gui.hd.hd.numDinkys.gotoAndStop("f" + this.dinkysToHit); theScreen.mc.onEnterFrame = bScreenEnterFrame; theScreen.mc.onMouseDown = bScreenMouseDown; }; BomberScreen.prototype.removeMini = function(mini) { delete this.mdArray[mini.num - 3]; }; BomberScreen.prototype.nextGo = function() { if(time >= this.timeLimit) { delete this.mc.onEnterFrame; gui.miniDinkyTimer.gotoAndPlay("timeUp"); var TUpause = function() { gui.dinkyNumbers.gotoAndStop(1); theScreen.levelCleared(); }; new TimerObject(2500,TUpause); } else if(this.dinkysToHit > 0) { colour = 8; this.oldBall = new Missile(-100,this); nextColour = 8; gui.nextBall.colour = nextColour + 1; if(gui.nextBall._currentFrame == 18) { gui.nextBall.gotoAndPlay(1); } else { gui.nextBall.go = true; } gui.dropTimer.gotoAndStop(1); } else { delete this.mc.onEnterFrame; gui.miniDinkyTimer.gotoAndPlay("wellDone"); var WDpause = function() { gui.miniDinkyTimer.gotoAndStop(1); gui.dinkyNumbers.gotoAndStop(1); theScreen.levelCleared(); }; new TimerObject(2500,WDpause); } }; BomberScreen.prototype.doDinkyNum = function() { if(this.dinkysToHit < 0) { this.dinkysToHit = 0; } gui.dinkyNumbers.num0.gotoAndStop(this.dinkysToHit % 10 + 1); gui.dinkyNumbers.num1.gotoAndStop(Math.floor(this.dinkysToHit / 10) + 1); }; BomberScreen.prototype.levelCleared = function() { Mouse.show(); Key.removeListener(myListener); delete theScreen.mc.onMouseDown; delete theScreen.mc.onEnterFrame; claw.gotoAndStop(1); gui.dropTimerCover.gotoAndPlay("lclose"); gui.doors.gotoAndPlay("close"); gui.doors.action = "levelCleared"; if(players == 1) { var addScore = 0; var levTime = this.timeLimit; if(time < levTime) { addScore = int((levTime - time) / 1000) * this.difficulty * this.level; doAvatar("jump"); } else { doAvatar("hangHead"); } score += addScore; gui.doors.addScore = addScore; level++; } }; Missile.prototype.explode = function() { var ma = theScreen.mdArray; var dinkysHit = 0; var i = 0; while(i < ma.length) { if(Math.abs(this.x - ma[i].mc._x) < 30) { if(ma[i].mc.onEnterFrame == miniMove) { var d = ma[i].mc._x - this.x; if(d < 3 && d > -3) { dinkysHit++; } theScreen.dinkysToHit--; dinkysHit++; delete ma[i].mc.onEnterFrame; ma[i].mc.xSpeed = Math.random() * 3 * d / 5; ma[i].mc.ySpeed = -7 - Math.random() * 14; ma[i].mc.rotate = 8 - Math.random() * 16; ma[i].mc.stopped = false; ma[i].mc.onEnterFrame = miniFly; var sh = new Sound(ma[i].mc); sh.attachSound("_lscream" + Math.ceil(Math.random() * 3)); sh.start(); } } i++; } if(dinkysHit > 0) { var scoreAdded = Math.ceil(theScreen.level * theScreen.difficulty) * 10 * dinkysHit; score += scoreAdded; theScreen.doScore(); var as = theScreen.mc.attachMovie("_laddScore","aScore" + theScreen.ID,10000 + theScreen.ID++); as.scr = scoreAdded; as._x = this.mc._x; as._y = this.mc._y; } theScreen.doDinkyNum(); theScreen.nextGo(); }; doneInstructionsOnce = false; InstructionScreen.prototype.populated = function() { if(doneInstructionsOnce) { colour = levelRandBall[this.level][this.ballCount++]; nextColour = levelRandBall[this.level][this.ballCount++]; claw.colour = colour; this.oldBall = new Ball(colour,-100,false,this); gui.nextBall.colour = nextColour + 1; gui.nextBall.gotoAndPlay(1); gui.doors.gotoAndPlay("open"); gui.dropTimerCover.gotoAndPlay("open"); claw.gotoAndPlay(1); claw._x = 60; gui.doors.gotoAndPlay("open"); instructions.gotoAndPlay(2); level = 1; this.level = 1; } else { colour = levelRandBall[this.level][this.ballCount++]; nextColour = levelRandBall[this.level][this.ballCount++]; claw.colour = colour; this.oldBall = new Ball(colour,-100,false,this); claw.gotoAndPlay(1); claw._x = 60; instrDropBall(); doneInstructionsOnce = true; removeInstructions(); doInstructions(); } }; InstructionScreen.prototype.nextGo = function() { colour = nextColour; if(colour < 8) { this.oldBall = new Ball(colour,-100,false,this); } else if(colour < 10) { this.oldBall = new Bomb(colour - 7,-100,this); } nextColour = levelRandBall[999][this.ballcount++]; gui.nextBall.colour = nextColour + 1; if(gui.nextBall._currentFrame == 18) { gui.nextBall.gotoAndPlay(1); } else { gui.nextBall.go = true; } gui.dropTimer.gotoAndStop(1); }; var i = 0; while(i < 7) { gui["score" + i].num = 0; gui["score" + i].stop(); i++; } _highquality = false; stop();