home *** CD-ROM | disk | FTP | other *** search
Wrap
Text File | 2007-09-27 | 58.8 KB | 1,868 lines
class LightSpriteGame { var lineDepth; var popUpDepth; var arrOrbs; var arrOrbsFired; var arrTargetObjects; var arrCleanup; var arrRelease; var arrSets; var arrSetCounter; var arrPopUpFlags; var popUpCounter; var orbDepth; var objectDepth; var pointDepth; var effectDepth; var orbSpeed; var orbMaxSpeed; var windResistance; var numGroundSpeed; var gameTargets; var blnHolding; var blnLeftSide; var keyCounter; var engineTimer; var difficultyPeopleCounter; var difficultyTimer; var refillType; var score; var numRelease; var setIndex; var targetCounter; var modeCounter; var blnMulti; var rainbowHold; var statCorrect; var statMissed; var statWrong; var statThrown; var statFull; var numEnergyMax; var numEnergy; var backAnimCounter; var backAnimMin; var backAnimMax; var blnArrows1; var blnArrows2; var multiOrbPointCounter; var mouseListener; var gameMode; var currentSet; function LightSpriteGame() { this.lineDepth = _root.lines.getDepth(); _root.lines.swapDepths(600); this.popUpDepth = _root.popUp.getDepth(); _root.popUp.swapDepths(11001); this.arrOrbs = new Array(); this.arrOrbsFired = new Array(); this.arrTargetObjects = new Array(); this.arrCleanup = new Array(); this.arrRelease = new Array(); this.arrSets = new Array(); if(_global.gameDifficulty == 1) { this.arrSetCounter = new Array(25,50,75,100,125,150,175); } else if(_global.gameDifficulty == 2) { this.arrSetCounter = new Array(30,60,90,120,150,180,210,240,270); } else if(_global.gameDifficulty == 3) { this.arrSetCounter = new Array(30,60,90,120,150,180,210,240,270,300,335,370); } else if(_global.gameDifficulty == 4) { this.arrSetCounter = new Array(30,60,90,120,150,180,210,240,270,300,335,370,400,430,460,490,510,540,570,600,630,660,690,720,750,780,910,940,1000,1100,1200); } else if(_global.gameDifficulty == 5) { this.arrSetCounter = new Array(30,60,90,120,150,180,210,240,270,300,335,370,400,430,460,490,510,540,570,600,630,660,690,720,750,780,910,940,1000,1100,1200); } this.arrPopUpFlags = new Array(false,false,false,false,false,false,false); this.popUpCounter = 0; this.orbDepth = 5000; this.objectDepth = 4000; this.pointDepth = 9000; this.effectDepth = 10000; this.orbSpeed = 0.4; this.orbMaxSpeed = 16; this.windResistance = 0; if(_global.gameDifficulty == 1) { this.numGroundSpeed = 0.6; this.gameTargets = 200; _root.energy._visible = false; } else if(_global.gameDifficulty == 2) { this.numGroundSpeed = 0.7; this.gameTargets = 300; _root.energy._visible = false; } else if(_global.gameDifficulty == 3) { this.numGroundSpeed = 0.7; this.gameTargets = 400; _root.energy._visible = false; } else if(_global.gameDifficulty == 4) { this.numGroundSpeed = 0.65; _root.energy._visible = true; this.UpdateEnergy(); } else if(_global.gameDifficulty == 5) { this.numGroundSpeed = 0.75; this.gameTargets = 400; _root.energy._visible = false; } this.blnHolding = false; this.blnLeftSide = true; this.keyCounter = 0; this.engineTimer = 50; this.difficultyPeopleCounter = 0; this.difficultyTimer = -1; this.refillType = 1; this.score = 0; this.numRelease = 1; this.setIndex = 0; this.targetCounter = 0; this.modeCounter = -1; this.blnMulti = false; this.rainbowHold = false; this.statCorrect = 0; this.statMissed = 0; this.statWrong = 0; this.statThrown = 0; this.statFull = 0; this.numEnergyMax = 20; this.numEnergy = 10; this.backAnimCounter = 500; this.backAnimMin = 400; this.backAnimMax = 1500; this.blnArrows1 = false; this.blnArrows2 = false; this.multiOrbPointCounter = 9999; this.mouseListener = new Object(); this.mouseListener.onMouseDown = function() { _root.OrbHold(); }; this.mouseListener.onMouseUp = function() { _root.OrbRelease(); }; Mouse.addListener(this.mouseListener); this.Setup(); this.gameMode = 1; _global.gamePaused = true; } function Run() { if(_global.gameDifficulty == 4) { if(this.gameMode == 1 || _global.gamePaused == false) { this.UpdateEnergy(); } } if(this.gameMode == 2) { if(this.modeCounter == 0) { _root.paused.gotoAndStop(4); this.gameMode = 3; this.modeCounter = 20; } else { this.modeCounter = this.modeCounter - 1; } } else if(this.gameMode == 3) { if(this.modeCounter == 0) { _root.paused.gotoAndStop(1); this.gameMode = 4; this.modeCounter = -1; _global.gamePaused = false; } else { this.modeCounter = this.modeCounter - 1; } } this.CheckKeyPress(); if(_global.gamePaused == false) { this.ManageHolding(); this.ManageFiredOrbs(); this.ManageObjects(); this.ControlDifficultyAndSurroundings(); this.OrbsFall(); this.UpdateScore(); this.UpdateBackAnim(); this.UpdateMultiOrb(); } this.DoCleanup(); _global.danceSync = _global.danceSync + 1; if(_global.danceSync == 69) { _global.danceSync = 20; } } function Setup() { _root.arrow1.stop(); _root.arrow2.stop(); _root.arrow3.stop(); _root.arrow4.stop(); _root.arrow5.stop(); _root.startPlayText.stop(); this.BuildSets(); this.SelectSet(); this.AddObject(this.currentSet.GetPiece()); this.engineTimer = 10; this.DropOrb(1); this.DropOrb(2); this.DropOrb(3); this.DropOrb(4); this.DropOrb(5); this.UpdateScore(); } function BeginGame() { this.gameMode = 2; _root.paused.gotoAndStop(3); this.modeCounter = 70; } function GameOver(blnCompleted) { _global.gamePaused = true; this.gameMode = 5; trace(blnCompleted); if(_global.gameDifficulty == 4) { _root.paused.gotoAndStop(6); _root.paused.completed_txt.text = "Game Over!"; } else { _root.paused.gotoAndStop(5); if(blnCompleted == false) { _root.paused.completed_txt.text = "Game Completed!"; } else { _root.paused.completed_txt.text = "Game Over!"; } } _root.paused.total_txt.text = this.targetCounter; _root.paused.thrown_txt.text = this.statThrown; _root.paused.correct_txt.text = this.statCorrect; _root.paused.wrong_txt.text = this.statWrong; _root.paused.missed_txt.text = this.statMissed; if(this.statThrown == 0) { _root.paused.accuracy_txt.text = "0%"; } else { _root.paused.accuracy_txt.text = Math.round(this.statCorrect / this.statThrown * 100) + "%"; } _root.paused.full_txt.text = this.statFull; _root.paused.score_txt.text = this.score; _global.lastScore = this.score; } function EndGame() { _root.paused.removeMovieClip(); var _loc4_ = 0; while(_loc4_ < this.arrOrbsFired.length) { _root[this.arrOrbsFired[_loc4_].name].removeMovieClip(); _loc4_ = _loc4_ + 1; } _loc4_ = 0; while(_loc4_ < this.arrOrbs.length) { _root[this.arrOrbs[_loc4_].name].removeMovieClip(); _loc4_ = _loc4_ + 1; } _loc4_ = 0; while(_loc4_ < this.arrTargetObjects.length) { _root[this.arrTargetObjects[_loc4_].name].removeMovieClip(); _loc4_ = _loc4_ + 1; } _root.transition2.gotoAndStop(1); _root.lines.swapDepths(this.lineDepth); _root.popUp.swapDepths(this.popUpDepth); _global.gamePaused = false; if(_global.gameDifficulty == 4) { _root.gotoAndPlay("submitScores"); } else { _root.gotoAndPlay("title"); } } function ControlDifficultyAndSurroundings() { if(_global.gameDifficulty == 1) { this.ControlEasy(); } else if(_global.gameDifficulty == 2) { this.ControlMedium(); } else if(_global.gameDifficulty == 3) { this.ControlHard(); } else if(_global.gameDifficulty == 4) { this.ControlChallenge(); } else if(_global.gameDifficulty == 5) { this.ControlInsane(); } } function ControlEasy() { switch(_global.difficulty) { case 1: if(this.difficultyPeopleCounter > 50) { this.difficultyPeopleCounter = 0; _global.difficulty = 2; this.AddButton("purple"); } break; case 2: if(this.difficultyPeopleCounter > 50) { this.difficultyPeopleCounter = 0; _global.difficulty = 3; } } } function ControlMedium() { switch(_global.difficulty) { case 1: if(this.difficultyPeopleCounter > 10) { this.difficultyPeopleCounter = 0; _global.difficulty = 2; this.AddButton("purple"); } break; case 2: if(this.difficultyPeopleCounter > 10) { this.difficultyPeopleCounter = 0; _global.difficulty = 3; } break; case 3: if(this.difficultyPeopleCounter > 10) { this.difficultyPeopleCounter = 0; _global.difficulty = 5; this.AddButton("blue"); } break; case 5: if(this.difficultyPeopleCounter > 10) { this.difficultyPeopleCounter = 0; _global.difficulty = 6; } break; case 6: if(this.difficultyPeopleCounter > 10) { this.difficultyPeopleCounter = 0; _global.difficulty = 7; } break; case 7: if(this.difficultyPeopleCounter > 10) { this.difficultyPeopleCounter = 0; _global.difficulty = 8; this.AddButton("green"); } break; case 8: if(this.difficultyPeopleCounter > 10) { this.difficultyPeopleCounter = 0; _global.difficulty = 9; } break; case 9: if(this.difficultyPeopleCounter > 25) { this.difficultyPeopleCounter = 0; _global.difficulty = 10; } break; case 10: if(this.difficultyPeopleCounter > 25) { this.difficultyPeopleCounter = 0; _global.difficulty = 11; } } } function ControlHard() { switch(_global.difficulty) { case 1: if(this.difficultyPeopleCounter > 10) { this.difficultyPeopleCounter = 0; _global.difficulty = 2; this.AddButton("purple"); } break; case 2: if(this.difficultyPeopleCounter > 10) { this.difficultyPeopleCounter = 0; _global.difficulty = 3; } break; case 3: if(this.difficultyPeopleCounter > 10) { this.difficultyPeopleCounter = 0; _global.difficulty = 5; this.AddButton("blue"); } break; case 5: if(this.difficultyPeopleCounter > 10) { this.difficultyPeopleCounter = 0; _global.difficulty = 6; } break; case 6: if(this.difficultyPeopleCounter > 10) { this.difficultyPeopleCounter = 0; _global.difficulty = 7; } break; case 7: if(this.difficultyPeopleCounter > 10) { this.difficultyPeopleCounter = 0; _global.difficulty = 8; this.AddButton("green"); } break; case 8: if(this.difficultyPeopleCounter > 10) { this.difficultyPeopleCounter = 0; _global.difficulty = 9; } break; case 9: if(this.difficultyPeopleCounter > 10) { this.difficultyPeopleCounter = 0; _global.difficulty = 10; } break; case 10: if(this.difficultyPeopleCounter > 15) { this.difficultyPeopleCounter = 0; _global.difficulty = 11; } break; case 11: if(this.difficultyPeopleCounter > 30) { this.difficultyPeopleCounter = 0; _global.difficulty = 13; this.AddButton("yellow"); } break; case 13: if(this.difficultyPeopleCounter > 10) { this.difficultyPeopleCounter = 0; _global.difficulty = 14; } break; case 14: if(this.difficultyPeopleCounter > 10) { this.difficultyPeopleCounter = 0; _global.difficulty = 15; } break; case 15: if(this.difficultyPeopleCounter > 10) { this.difficultyPeopleCounter = 0; _global.difficulty = 16; } break; case 16: if(this.difficultyPeopleCounter > 30) { this.difficultyPeopleCounter = 0; _global.difficulty = 17; this.AddButton("orange"); } break; case 17: if(this.difficultyPeopleCounter > 10) { this.difficultyPeopleCounter = 0; _global.difficulty = 18; } break; case 18: if(this.difficultyPeopleCounter > 10) { this.difficultyPeopleCounter = 0; _global.difficulty = 19; } break; case 19: if(this.difficultyPeopleCounter > 20) { this.difficultyPeopleCounter = 0; _global.difficulty = 20; } break; case 20: if(this.difficultyPeopleCounter > 50) { this.difficultyPeopleCounter = 0; _global.difficulty = 21; } } } function ControlInsane() { switch(_global.difficulty) { case 1: if(this.difficultyPeopleCounter > 5) { this.difficultyPeopleCounter = 0; _global.difficulty = 2; this.AddButton("purple"); } break; case 2: if(this.difficultyPeopleCounter > 5) { this.difficultyPeopleCounter = 0; _global.difficulty = 5; this.AddButton("blue"); } break; case 5: if(this.difficultyPeopleCounter > 5) { this.difficultyPeopleCounter = 0; _global.difficulty = 8; this.AddButton("green"); } break; case 8: if(this.difficultyPeopleCounter > 5) { this.difficultyPeopleCounter = 0; _global.difficulty = 13; this.AddButton("yellow"); } break; case 13: if(this.difficultyPeopleCounter > 5) { this.difficultyPeopleCounter = 0; _global.difficulty = 17; this.AddButton("orange"); } break; case 17: if(this.difficultyPeopleCounter > 10) { this.difficultyPeopleCounter = 0; _global.difficulty = 19; } break; case 19: if(this.difficultyPeopleCounter > 100) { this.difficultyPeopleCounter = 0; _global.difficulty = 20; } break; case 20: if(this.difficultyPeopleCounter > 100) { this.difficultyPeopleCounter = 0; _global.difficulty = 21; } break; case 21: if(this.difficultyPeopleCounter > 100) { this.difficultyPeopleCounter = 0; _global.difficulty = 22; } break; case 22: if(this.difficultyPeopleCounter > 50) { this.difficultyPeopleCounter = 0; this.numGroundSpeed += 0.05; } } } function ControlChallenge() { switch(_global.difficulty) { case 1: if(this.difficultyPeopleCounter > 10) { this.difficultyPeopleCounter = 0; _global.difficulty = 2; this.AddButton("purple"); } break; case 2: if(this.difficultyPeopleCounter > 10) { this.difficultyPeopleCounter = 0; _global.difficulty = 3; } break; case 3: if(this.difficultyPeopleCounter > 20) { this.difficultyPeopleCounter = 0; _global.difficulty = 4; this.AddButton("blue"); } break; case 4: this.numGroundSpeed += 0.05; _global.difficulty = 5; case 5: if(this.difficultyPeopleCounter > 10) { this.difficultyPeopleCounter = 0; _global.difficulty = 6; } break; case 6: if(this.difficultyPeopleCounter > 10) { this.difficultyPeopleCounter = 0; _global.difficulty = 7; } break; case 7: if(this.difficultyPeopleCounter > 10) { this.difficultyPeopleCounter = 0; _global.difficulty = 8; this.AddButton("green"); } break; case 8: if(this.difficultyPeopleCounter > 10) { this.difficultyPeopleCounter = 0; _global.difficulty = 9; } break; case 9: if(this.difficultyPeopleCounter > 10) { this.difficultyPeopleCounter = 0; _global.difficulty = 10; } break; case 10: if(this.difficultyPeopleCounter > 10) { this.difficultyPeopleCounter = 0; _global.difficulty = 11; } break; case 11: if(this.difficultyPeopleCounter > 10) { this.difficultyPeopleCounter = 0; _global.difficulty = 12; this.AddButton("yellow"); } break; case 12: this.numGroundSpeed += 0.05; _global.difficulty = 13; case 13: if(this.difficultyPeopleCounter > 10) { this.difficultyPeopleCounter = 0; _global.difficulty = 14; } break; case 14: if(this.difficultyPeopleCounter > 10) { this.difficultyPeopleCounter = 0; _global.difficulty = 15; } break; case 15: if(this.difficultyPeopleCounter > 10) { this.difficultyPeopleCounter = 0; _global.difficulty = 16; } break; case 16: if(this.difficultyPeopleCounter > 10) { this.difficultyPeopleCounter = 0; _global.difficulty = 17; this.AddButton("orange"); } break; case 17: if(this.difficultyPeopleCounter > 10) { this.difficultyPeopleCounter = 0; _global.difficulty = 18; } break; case 18: if(this.difficultyPeopleCounter > 20) { this.difficultyPeopleCounter = 0; _global.difficulty = 19; } break; case 19: if(this.difficultyPeopleCounter > 20) { this.difficultyPeopleCounter = 0; _global.difficulty = 20; } break; case 20: if(this.difficultyPeopleCounter > 100) { this.difficultyPeopleCounter = 0; _global.difficulty = 21; } break; case 21: if(this.difficultyPeopleCounter > 100) { this.difficultyPeopleCounter = 0; _global.difficulty = 22; } break; case 22: if(this.difficultyPeopleCounter > 50) { this.numGroundSpeed += 0.05; this.difficultyPeopleCounter = 0; break; } } } function BuildSets() { var _loc2_ = undefined; _loc2_ = new Set(); _loc2_.AddPiece("hill_1",60,60,100); _loc2_.AddPiece("hill_2",40,60,100); this.arrSets.push(_loc2_); _loc2_ = new Set(); _loc2_.AddPiece("island_1",80,60,100); _loc2_.AddPiece("pirate_boat_1",20,60,100); this.arrSets.push(_loc2_); _loc2_ = new Set(); _loc2_.AddPiece("egypt_1",40,100,140); _loc2_.AddPiece("egypt_2",60,40,80); this.arrSets.push(_loc2_); _loc2_ = new Set(); _loc2_.AddPiece("china_1",30,120,140); _loc2_.AddPiece("china_2",70,60,100); this.arrSets.push(_loc2_); _loc2_ = new Set(); _loc2_.AddPiece("grass_1",100,80,100); this.arrSets.push(_loc2_); _loc2_ = new Set(); _loc2_.AddPiece("arctic_1",40,80,100); _loc2_.AddPiece("arctic_2",20,80,100); _loc2_.AddPiece("arctic_3",20,60,100); _loc2_.AddPiece("arctic_4",30,60,100); this.arrSets.push(_loc2_); _loc2_ = new Set(); _loc2_.AddPiece("city_1",100,80,100); this.arrSets.push(_loc2_); _loc2_ = new Set(); _loc2_.AddPiece("jungle_1",50,80,100); _loc2_.AddPiece("jungle_2",50,80,100); this.arrSets.push(_loc2_); _loc2_ = new Set(); _loc2_.AddPiece("savannah_1",50,80,100); _loc2_.AddPiece("savannah_2",50,80,100); this.arrSets.push(_loc2_); _loc2_ = new Set(); _loc2_.AddPiece("western_1",70,80,120); _loc2_.AddPiece("western_2",30,80,120); this.arrSets.push(_loc2_); _loc2_ = new Set(); _loc2_.AddPiece("india_1",30,100,140); _loc2_.AddPiece("india_2",70,80,100); this.arrSets.push(_loc2_); _loc2_ = new Set(); _loc2_.AddPiece("japan_1",30,100,120); _loc2_.AddPiece("japan_2",45,100,120); _loc2_.AddPiece("japan_3",25,120,150); this.arrSets.push(_loc2_); } function SelectSet() { if(this.arrSets.length > 0) { var _loc2_ = Math.round(Math.random() * (this.arrSets.length - 1)); this.currentSet = this.arrSets[_loc2_]; this.arrSets.splice(_loc2_,1); } else { this.BuildSets(); _loc2_ = Math.round(Math.random() * (this.arrSets.length - 1)); this.currentSet = this.arrSets[_loc2_]; this.arrSets.splice(_loc2_,1); } } function ResumeThisGame() { if(this.gameMode == 4) { _global.gamePaused = false; _root.paused.gotoAndStop(1); } } function CheckKeyPress() { if(this.keyCounter <= 0) { if(Key.isDown(39)) { this.keyCounter = 20; this.SelectSet(); } else if(Key.isDown(80) || Key.isDown(27)) { if(this.gameMode == 4) { this.keyCounter = 20; if(_global.gamePaused == false) { _global.gamePaused = true; _root.paused.gotoAndStop(2); if(_global.gameDifficulty == 1) { _root.paused.through_txt.text = Math.round((200 - this.gameTargets) / 200 * 100) + "% Through Game"; } else if(_global.gameDifficulty == 2) { _root.paused.through_txt.text = Math.round((300 - this.gameTargets) / 300 * 100) + "% Through Game"; } else if(_global.gameDifficulty == 3 || _global.gameDifficulty == 5) { _root.paused.through_txt.text = Math.round((400 - this.gameTargets) / 400 * 100) + "% Through Game"; } else { _root.paused.through_txt.text = ""; } } else { _global.gamePaused = false; _root.paused.gotoAndStop(1); } } } if(this.gameMode == 4) { if(Key.isDown(_global.hotKey_red)) { this.ChangeOrbs(1); } else if(Key.isDown(_global.hotKey_purple)) { if(_global.difficulty >= 2) { this.ChangeOrbs(2); } } else if(Key.isDown(_global.hotKey_blue)) { if(_global.difficulty >= 5) { this.ChangeOrbs(3); } } else if(Key.isDown(_global.hotKey_green)) { if(_global.difficulty >= 8) { this.ChangeOrbs(4); } } else if(Key.isDown(_global.hotKey_yellow)) { if(_global.difficulty >= 13) { this.ChangeOrbs(5); } } else if(Key.isDown(_global.hotKey_orange)) { if(_global.difficulty >= 17) { this.ChangeOrbs(6); } } else if(Key.isDown(_global.hotKey_multi)) { if(this.blnMulti == true) { this.ChangeOrbs(7); } } } } else { this.keyCounter = this.keyCounter - 1; } } function UpdateEnergy() { if(this.gameMode == 4) { if(this.numEnergy <= 0) { this.GameOver(true); } } if(this.numEnergy > this.numEnergyMax) { this.numEnergy = this.numEnergyMax; } var _loc3_ = Math.round(this.numEnergy / this.numEnergyMax * 100); _root.energy.inside._yscale = _loc3_; if(_loc3_ <= 25) { _root.energy.inside.gotoAndStop(2); } else { _root.energy.inside.gotoAndStop(1); } } function DropOrb(orbSlot) { if(this.blnMulti == false && this.refillType == 7) { this.refillType = 1; } var _loc3_ = "Orb_" + this.orbDepth; _root.attachMovie("orb red",_loc3_,this.orbDepth); _root[_loc3_].gotoAndStop(this.refillType); _root[_loc3_]._y = _root.drop1._y; switch(orbSlot) { case 1: _root[_loc3_]._x = _root.drop1._x; break; case 2: _root[_loc3_]._x = _root.drop2._x; break; case 3: _root[_loc3_]._x = _root.drop3._x; break; case 4: _root[_loc3_]._x = _root.drop4._x; break; case 5: _root[_loc3_]._x = _root.drop5._x; } this.arrOrbs.push({name:_loc3_,speed:0.5,hold:false,startX:_root[_loc3_]._x,startY:0,slot:orbSlot,type:this.refillType}); this.orbDepth = this.orbDepth + 1; if(this.orbDepth > 6000) { this.orbDepth = 5000; } } function OrbsFall() { var _loc3_ = 0; while(_loc3_ < this.arrOrbs.length) { if(_root[this.arrOrbs[_loc3_].name]._y < _root.land._y && this.arrOrbs[_loc3_].hold == false) { if(_root[this.arrOrbs[_loc3_].name]._y + this.arrOrbs[_loc3_].speed >= _root.land._y) { _root[this.arrOrbs[_loc3_].name]._y = _root.land._y; if(this.blnArrows1 == false) { this.blnArrows1 = true; _root.arrow1.play(); _root.arrow2.play(); _root.arrow3.play(); _root.arrow4.play(); _root.arrow5.play(); _root.startPlayText.play(); } } else { _root[this.arrOrbs[_loc3_].name]._y += this.arrOrbs[_loc3_].speed; this.arrOrbs[_loc3_].speed += this.orbSpeed; } } _loc3_ = _loc3_ + 1; } } function ManageFiredOrbs() { var _loc11_ = new Array(); var _loc12_ = 0; while(_loc12_ < this.arrOrbsFired.length) { _root[this.arrOrbsFired[_loc12_].name]._y += this.arrOrbsFired[_loc12_].moveY; this.arrOrbsFired[_loc12_].moveY += this.orbSpeed; if(this.arrOrbsFired[_loc12_].moveY > this.orbMaxSpeed) { this.arrOrbsFired[_loc12_].moveY = this.orbMaxSpeed; } if(_root[this.arrOrbsFired[_loc12_].name]._y - _root[this.arrOrbsFired[_loc12_].name]._height / 2 > Stage.height) { _loc11_.push(this.arrOrbsFired[_loc12_].name); } _root[this.arrOrbsFired[_loc12_].name]._x += this.arrOrbsFired[_loc12_].moveX; if(this.arrOrbsFired[_loc12_].moveX < 0) { this.arrOrbsFired[_loc12_].moveX += this.windResistance; if(this.arrOrbsFired[_loc12_].moveX > 0.1) { this.arrOrbsFired[_loc12_].moveX = 0; } } else if(this.arrOrbsFired[_loc12_].moveX > 0) { this.arrOrbsFired[_loc12_].moveX -= this.windResistance; if(this.arrOrbsFired[_loc12_].moveX < 0.1) { this.arrOrbsFired[_loc12_].moveX = 0; } } if(_global.trailOn == true) { var _loc9_ = "effect" + this.effectDepth; if(this.arrOrbsFired[_loc12_].type == 1) { _root.attachMovie("redEffect",_loc9_,this.effectDepth); } else if(this.arrOrbsFired[_loc12_].type == 2) { _root.attachMovie("purpleEffect",_loc9_,this.effectDepth); } else if(this.arrOrbsFired[_loc12_].type == 3) { _root.attachMovie("blueEffect",_loc9_,this.effectDepth); } else if(this.arrOrbsFired[_loc12_].type == 4) { _root.attachMovie("greenEffect",_loc9_,this.effectDepth); } else if(this.arrOrbsFired[_loc12_].type == 5) { _root.attachMovie("yellowEffect",_loc9_,this.effectDepth); } else if(this.arrOrbsFired[_loc12_].type == 6) { _root.attachMovie("orangeEffect",_loc9_,this.effectDepth); } else if(this.arrOrbsFired[_loc12_].type == 7) { _root.attachMovie("multiEffect",_loc9_,this.effectDepth); } _root[_loc9_]._x = _root[this.arrOrbsFired[_loc12_].name]._x; _root[_loc9_]._y = _root[this.arrOrbsFired[_loc12_].name]._y; this.effectDepth = this.effectDepth + 1; if(this.effectDepth > 11000) { this.effectDepth = 10000; } } _loc12_ = _loc12_ + 1; } var _loc8_ = undefined; _loc12_ = 0; while(_loc12_ < this.arrOrbsFired.length) { var _loc7_ = 0; while(_loc7_ < this.arrTargetObjects.length) { if(this.arrTargetObjects[_loc7_].down == true) { if(_root[this.arrOrbsFired[_loc12_].name].hitTest(_root[this.arrTargetObjects[_loc7_].name])) { _loc8_ = _root[this.arrTargetObjects[_loc7_].name].CheckHits(this.arrOrbsFired[_loc12_].name,this.arrOrbsFired[_loc12_].type); if(_loc8_._hit == true) { _loc11_.push(this.arrOrbsFired[_loc12_].name); this.difficultyPeopleCounter = this.difficultyPeopleCounter + 1; if(_loc8_._correctColor == true) { var _loc4_ = 0; this.statCorrect = this.statCorrect + 1; this.popUpCounter = this.popUpCounter + 1; if(this.popUpCounter >= 10 && this.arrPopUpFlags[0] == false) { this.arrPopUpFlags[0] = true; _root.popUp.gotoAndPlay(2); _loc4_ = 100; } else if(this.popUpCounter >= 25 && this.arrPopUpFlags[1] == false) { this.arrPopUpFlags[1] = true; _root.popUp.gotoAndPlay(3); _loc4_ = 250; } else if(this.popUpCounter >= 50 && this.arrPopUpFlags[2] == false) { this.arrPopUpFlags[2] = true; _root.popUp.gotoAndPlay(4); _loc4_ = 500; } else if(this.popUpCounter >= 75 && this.arrPopUpFlags[3] == false) { this.arrPopUpFlags[3] = true; _root.popUp.gotoAndPlay(5); _loc4_ = 750; } else if(this.popUpCounter >= 100 && this.arrPopUpFlags[4] == false) { this.arrPopUpFlags[4] = true; _root.popUp.gotoAndPlay(6); _loc4_ = 1000; } else if(this.popUpCounter >= 150 && this.arrPopUpFlags[5] == false) { this.arrPopUpFlags[5] = true; _root.popUp.gotoAndPlay(7); _loc4_ = 1500; } else if(this.popUpCounter >= 200 && this.arrPopUpFlags[6] == false) { this.arrPopUpFlags[6] = true; _root.popUp.gotoAndPlay(8); _loc4_ = 2000; } this.score = _loc4_ + this.score; if(this.multiOrbPointCounter != 9999) { this.multiOrbPointCounter -= _loc4_; } _loc4_ = 0; var _loc10_ = Math.round(Math.random() * 100); if(_loc10_ < 90) { _global.SoundManager.PlayHitSound("hit"); } else { _loc10_ = Math.round(Math.random() * 7) + 1; switch(_loc10_) { case 1: _global.SoundManager.PlayVoiceSound("funny1"); break; case 2: _global.SoundManager.PlayVoiceSound("funny2"); break; case 3: _global.SoundManager.PlayVoiceSound("funny3"); break; case 4: _global.SoundManager.PlayVoiceSound("funny4"); break; case 5: _global.SoundManager.PlayVoiceSound("funny5"); break; case 6: _global.SoundManager.PlayVoiceSound("funny6"); break; case 7: _global.SoundManager.PlayVoiceSound("funny7"); break; case 8: _global.SoundManager.PlayVoiceSound("funny8"); } } var _loc6_ = 0; while(_loc6_ < this.arrRelease.length) { if(this.arrRelease[_loc6_].id == this.arrOrbsFired[_loc12_].id) { this.arrRelease[_loc6_].count = this.arrRelease[_loc6_].count + 1; _loc4_ = 10 * this.arrRelease[_loc6_].count; break; } _loc6_ = _loc6_ + 1; } if(this.arrOrbsFired[_loc12_].type == 7) { if(this.rainbowHold == false) { _root.rainbow.gotoAndPlay(2); this.rainbowHold = true; } } this.score = _loc4_ + this.score; this.AddPointMarker(_loc4_,_loc8_._x,_loc8_._y,false); if(this.multiOrbPointCounter != 9999) { this.multiOrbPointCounter -= _loc4_; } if(_loc8_._allCorrect == true) { _loc4_ = 50 * _loc8_._numTargets; this.score = _loc4_ + this.score; this.numEnergy = this.numEnergy + 1; if(this.multiOrbPointCounter != 9999) { this.multiOrbPointCounter -= _loc4_; } var _loc5_ = new Object(); _loc5_.x = _root[this.arrTargetObjects[_loc7_].name].score._x; _loc5_.y = _root[this.arrTargetObjects[_loc7_].name].score._y; _root[this.arrTargetObjects[_loc7_].name].localToGlobal(_loc5_); if(_loc5_.x - 20 < 0) { _loc5_.x = 30; } if(_loc5_.x + 20 > Stage.width) { _loc5_.x = Stage.width - 30; } this.AddPointMarker(_loc4_,_loc5_.x,_loc5_.y,true); this.statFull = this.statFull + 1; } } else { this.statWrong = this.statWrong + 1; this.numEnergy -= 2; this.popUpCounter = 0; this.arrPopUpFlags[0] = false; this.arrPopUpFlags[1] = false; this.arrPopUpFlags[2] = false; this.arrPopUpFlags[3] = false; this.arrPopUpFlags[4] = false; this.arrPopUpFlags[5] = false; this.arrPopUpFlags[6] = false; } break; } } } _loc7_ = _loc7_ + 1; } _loc12_ = _loc12_ + 1; } _loc12_ = 0; while(_loc12_ < _loc11_.length) { this.CleanupFiredOrb(_loc11_[_loc12_]); _loc12_ = _loc12_ + 1; } } function CleanupFiredOrb(strName) { var _loc3_ = 0; while(_loc3_ < this.arrOrbsFired.length) { if(strName == this.arrOrbsFired[_loc3_].name) { _root[this.arrOrbsFired[_loc3_].name].removeMovieClip(); this.arrOrbsFired.splice(_loc3_,1); break; } _loc3_ = _loc3_ + 1; } } function HoldOrbs() { var _loc3_ = 0; while(_loc3_ < this.arrOrbs.length) { if(_root[this.arrOrbs[_loc3_].name].hitTest(_xmouse,_ymouse,true)) { this.blnHolding = true; this.arrOrbs[_loc3_].hold = true; this.arrOrbs[_loc3_].startY = _root[this.arrOrbs[_loc3_].name]._y; } _loc3_ = _loc3_ + 1; } } function ChangeOrbs(numType) { var _loc3_ = 0; while(_loc3_ < this.arrOrbs.length) { _root[this.arrOrbs[_loc3_].name].gotoAndStop(numType); this.arrOrbs[_loc3_].type = numType; _loc3_ = _loc3_ + 1; } this.refillType = numType; } function ChangeHeldOrbs(numType) { var _loc3_ = 0; while(_loc3_ < this.arrOrbs.length) { if(this.arrOrbs[_loc3_].hold == true) { _root[this.arrOrbs[_loc3_].name].gotoAndStop(numType); this.arrOrbs[_loc3_].type = numType; } _loc3_ = _loc3_ + 1; } } function ReleaseOrbs() { if(_global.lockHold == false) { _global.lockRelease = true; this.blnHolding = false; _root.lines.clear(); var _loc5_ = new Array(); var _loc4_ = 0; while(_loc4_ < this.arrOrbs.length) { if(this.arrOrbs[_loc4_].hold == true) { _loc5_.push(this.arrOrbs[_loc4_].name); } _loc4_ = _loc4_ + 1; } this.arrRelease.push({id:this.numRelease,count:0}); _loc4_ = 0; while(_loc4_ < _loc5_.length) { this.FireOrb(_loc5_[_loc4_],this.numRelease); _loc4_ = _loc4_ + 1; } if(this.numRelease > 2) { this.arrRelease.shift(); } this.numRelease = this.numRelease + 1; _global.lockRelease = false; } } function FireOrb(strName, releaseNum) { var _loc4_ = 0; while(_loc4_ < this.arrOrbs.length) { if(strName == this.arrOrbs[_loc4_].name) { var _loc8_ = this.arrOrbs[_loc4_].startX - _root[this.arrOrbs[_loc4_].name]._x; var _loc7_ = this.arrOrbs[_loc4_].startY - _root[this.arrOrbs[_loc4_].name]._y; var _loc6_ = Math.sqrt(_loc8_ * _loc8_ + _loc7_ * _loc7_); var _loc5_ = _loc6_ / 200; if(_loc5_ > 1) { _loc5_ = 1; } _loc5_ = Math.round(_loc5_ * 12); var _loc10_ = 0; var _loc9_ = 0; if(_loc6_ != 0) { _loc10_ = _loc8_ / _loc6_ * _loc5_; _loc9_ = _loc7_ / _loc6_ * _loc5_; } this.arrOrbsFired.push({name:strName,moveX:_loc10_,moveY:_loc9_,type:this.arrOrbs[_loc4_].type,id:releaseNum}); if(this.arrOrbs[_loc4_].type == 7) { if(this.blnMulti == true) { if(_global.gameDifficulty == 1) { this.blnMulti = false; this.AddButton("easyMultiGone"); } else if(_global.gameDifficulty == 2) { this.blnMulti = false; this.AddButton("medMultiGone"); } else if(_global.gameDifficulty == 3) { this.blnMulti = false; this.AddButton("multiGone"); } else if(_global.gameDifficulty == 4) { this.blnMulti = false; this.AddButton("multiGone"); } else if(_global.gameDifficulty == 5) { this.blnMulti = false; this.AddButton("multiGone"); } } } this.DropOrb(this.arrOrbs[_loc4_].slot); this.arrOrbs.splice(_loc4_,1); this.statThrown = this.statThrown + 1; break; } _loc4_ = _loc4_ + 1; } } function ManageHolding() { if(_global.lockRelease == false) { _global.lockHold = true; if(this.blnHolding == true) { var _loc4_ = 0; while(_loc4_ < this.arrOrbs.length) { if(this.arrOrbs[_loc4_].hold == false) { if(_root[this.arrOrbs[_loc4_].name].hitTest(_xmouse,_ymouse,true)) { this.arrOrbs[_loc4_].hold = true; this.arrOrbs[_loc4_].startY = _root[this.arrOrbs[_loc4_].name]._y; } } else { _root[this.arrOrbs[_loc4_].name]._x = _xmouse; if(_ymouse < _root.farthest._y) { _root[this.arrOrbs[_loc4_].name]._y = _ymouse; } else { _root[this.arrOrbs[_loc4_].name]._y = _root.farthest._y; } } _loc4_ = _loc4_ + 1; } var _loc5_ = new Object(); _loc5_.x = _xmouse; _loc5_.y = _ymouse; var _loc6_ = undefined; if(_global.difficulty >= 2) { if(_root.select.cover1.hitTest(_loc5_.x,_loc5_.y,true)) { this.ChangeHeldOrbs(1); } else if(_root.select.cover2.hitTest(_loc5_.x,_loc5_.y,true)) { this.ChangeHeldOrbs(2); } } if(_global.difficulty >= 5) { if(_root.select.cover3.hitTest(_loc5_.x,_loc5_.y,true)) { this.ChangeHeldOrbs(3); } } if(_global.difficulty >= 8) { if(_root.select.cover4.hitTest(_loc5_.x,_loc5_.y,true)) { this.ChangeHeldOrbs(4); } } if(_global.difficulty >= 13) { if(_root.select.cover5.hitTest(_loc5_.x,_loc5_.y,true)) { this.ChangeHeldOrbs(5); } } if(_global.difficulty >= 17) { if(_root.select.cover6.hitTest(_loc5_.x,_loc5_.y,true)) { this.ChangeHeldOrbs(6); } } if(this.blnMulti == true) { if(_root.select.cover7.hitTest(_loc5_.x,_loc5_.y,true)) { this.ChangeHeldOrbs(7); } } this.DrawLines(); } _global.lockHold = false; } } function CheckChangeType(numType) { if(this.blnHolding == true) { this.ChangeOrbs(numType); } } function DrawLines() { _root.lines.clear(); _root.lines.lineStyle(1,0,50); var _loc4_ = new Object(); var _loc5_ = new Object(); var _loc3_ = 0; while(_loc3_ < this.arrOrbs.length) { if(this.arrOrbs[_loc3_].hold == true) { _loc4_.x = this.arrOrbs[_loc3_].startX; _loc4_.y = this.arrOrbs[_loc3_].startY; _loc5_.x = _root[this.arrOrbs[_loc3_].name]._x; _loc5_.y = _root[this.arrOrbs[_loc3_].name]._y; _root.lines.globalToLocal(_loc4_); _root.lines.globalToLocal(_loc5_); _root.lines.moveTo(_loc4_.x,_loc4_.y); _root.lines.lineTo(_loc5_.x,_loc5_.y); } _loc3_ = _loc3_ + 1; } } function AddObject(linkID) { var _loc3_ = "obj" + this.objectDepth; _root.attachMovie(linkID,_loc3_,this.objectDepth); this.arrTargetObjects.push({name:_loc3_,down:false}); if(this.blnLeftSide == true) { var _loc5_ = Math.round(Math.random() * 100) - 100; this.blnLeftSide = false; } else { _loc5_ = Math.round(Math.random() * 200) + 100; this.blnLeftSide = true; } _root[_loc3_]._x = _loc5_; _root[_loc3_]._y = Stage.height + _root[_loc3_]._height; var _loc4_ = _root[_loc3_].AdjustTargets(); this.targetCounter += _loc4_; this.gameTargets -= _loc4_; if(this.setIndex != this.arrSetCounter.length) { if(this.targetCounter >= this.arrSetCounter[this.setIndex]) { this.setIndex = this.setIndex + 1; var _loc7_ = this.currentSet.GetMinNext(); var _loc6_ = this.currentSet.GetMaxNext(); this.SelectSet(); this.currentSet.SetMinMax(_loc7_,_loc6_); } } this.objectDepth = this.objectDepth - 1; if(this.objectDepth < 1000) { this.objectDepth = 4000; } } function ManageObjects() { var _loc6_ = new Array(); var _loc4_ = 0; while(_loc4_ < this.arrTargetObjects.length) { if(this.arrTargetObjects[_loc4_].down == true) { _root[this.arrTargetObjects[_loc4_].name]._y += this.numGroundSpeed; if(_root[this.arrTargetObjects[_loc4_].name]._y - _root[this.arrTargetObjects[_loc4_].name]._height > Stage.height) { _loc6_.push(this.arrTargetObjects[_loc4_].name); this.statMissed += _root[this.arrTargetObjects[_loc4_].name].GetTargetsLeft(); this.numEnergy -= Math.round(_root[this.arrTargetObjects[_loc4_].name].GetTargetsLeft() * 1.5); } } else { var _loc5_ = 0.15 * (_root[this.arrTargetObjects[_loc4_].name]._y - _root.start._y); if(_loc5_ <= 1) { _root[this.arrTargetObjects[_loc4_].name]._y = _root.start._y; this.arrTargetObjects[_loc4_].down = true; } else { _root[this.arrTargetObjects[_loc4_].name]._y -= _loc5_; } } _loc4_ = _loc4_ + 1; } _loc4_ = 0; while(_loc4_ < _loc6_.length) { this.RemoveObjects(_loc6_[_loc4_]); _loc4_ = _loc4_ + 1; } if(this.gameTargets > 0 || _global.gameDifficulty == 4) { this.engineTimer -= this.numGroundSpeed; if(this.engineTimer <= 0) { this.AddObject(this.currentSet.GetPiece()); this.engineTimer = Math.round(Math.random() * (this.currentSet.GetMaxNext() - this.currentSet.GetMinNext())) + this.currentSet.GetMinNext(); } } else if(this.arrTargetObjects.length == 0) { this.GameOver(false); } } function RemoveObjects(strName) { var _loc3_ = 0; while(_loc3_ < this.arrTargetObjects.length) { if(strName == this.arrTargetObjects[_loc3_].name) { _root[this.arrTargetObjects[_loc3_].name].removeMovieClip(); this.arrTargetObjects.splice(_loc3_,1); break; } _loc3_ = _loc3_ + 1; } } function AddButton(strName) { _root.select.gotoAndPlay(strName); } function UpdateScore() { _root.score_txt.text = this.score; } function AddToCleanup(myName) { this.arrCleanup.push({name:myName,counter:40}); } function DoCleanup() { var _loc4_ = new Array(); var _loc3_ = 0; while(_loc3_ < this.arrCleanup.length) { this.arrCleanup[_loc3_].counter--; if(this.arrCleanup[_loc3_].counter == 0) { _loc4_.push(this.arrCleanup[_loc3_].name); } _loc3_ = _loc3_ + 1; } _loc3_ = 0; while(_loc3_ < _loc4_.length) { _root[_loc4_[_loc3_]].removeMovieClip(); this.RemoveCleanupItem(_loc4_[_loc3_]); _loc3_ = _loc3_ + 1; } } function RemoveCleanupItem(strName) { var _loc2_ = 0; while(_loc2_ < this.arrCleanup.length) { if(strName == this.arrCleanup[_loc2_].name) { this.arrCleanup.splice(_loc2_,1); break; } _loc2_ = _loc2_ + 1; } } function AddPointMarker(points, xLoc, yLoc, blnObject) { var _loc3_ = "points" + this.pointDepth; _root.attachMovie("points",_loc3_,this.pointDepth); _root[_loc3_]._y = yLoc - 20; _root[_loc3_]._x = xLoc; var _loc4_ = undefined; if(blnObject == false) { _loc4_ = points / 10; } else { _loc4_ = points / 50 + 5; } _root[_loc3_].inside.gotoAndStop(_loc4_); this.AddToCleanup(_loc3_); this.pointDepth = this.pointDepth + 1; if(this.pointDepth > 9050) { this.pointDepth = 9000; } } function OverAnim() { this.rainbowHold = false; } function UpdateBackAnim() { if(this.backAnimCounter <= 0) { var _loc3_ = Math.round(Math.random() * 5) + 2; var _loc4_ = Math.round(Math.random() * (this.backAnimMax - this.backAnimMin)) + this.backAnimMin; trace("Playing: " + _loc3_ + " Next: " + _loc4_); _root.backanim.gotoAndPlay(_loc3_); this.backAnimCounter = _loc4_; } else { this.backAnimCounter = this.backAnimCounter - 1; } } function UpdateMultiOrb() { if(this.multiOrbPointCounter <= 0) { if(_global.gameDifficulty == 1) { if(_global.difficulty >= 2 && this.blnMulti == false) { this.blnMulti = true; this.AddButton("easyMulti"); this.multiOrbPointCounter = 4000; } } else if(_global.gameDifficulty == 2) { if(_global.difficulty >= 8 && this.blnMulti == false) { this.blnMulti = true; this.AddButton("medMulti"); this.multiOrbPointCounter = 4000; } } else if(_global.gameDifficulty == 3) { if(_global.difficulty >= 17 && this.blnMulti == false) { this.blnMulti = true; this.AddButton("multi"); this.multiOrbPointCounter = 4000; } } else if(_global.gameDifficulty == 4) { if(_global.difficulty >= 17 && this.blnMulti == false) { this.blnMulti = true; this.AddButton("multi"); this.multiOrbPointCounter = 4000; } } else if(_global.gameDifficulty == 5) { if(_global.difficulty >= 17 && this.blnMulti == false) { this.blnMulti = true; this.AddButton("multi"); this.multiOrbPointCounter = 4000; } } this.multiOrbPointCounter = 4000; } else if(this.multiOrbPointCounter == 9999) { if(_global.gameDifficulty == 1) { if(_global.difficulty >= 2) { this.multiOrbPointCounter = 1000; } } else if(_global.gameDifficulty == 2) { if(_global.difficulty >= 8) { this.multiOrbPointCounter = 1000; } } else if(_global.gameDifficulty == 3) { if(_global.difficulty >= 17) { this.multiOrbPointCounter = 1000; } } else if(_global.gameDifficulty == 4) { if(_global.difficulty >= 17) { this.multiOrbPointCounter = 1000; } } else if(_global.gameDifficulty == 5) { if(_global.difficulty >= 17) { this.multiOrbPointCounter = 1000; } } } } }