home *** CD-ROM | disk | FTP | other *** search
- function resetArrays()
- {
- wordFrames = new Array();
- i = 10;
- while(27 >= i)
- {
- wordFrames.push(i);
- i++;
- }
- usedFrames = new Array();
- pickWordFrame();
- }
- function pickWordFrame()
- {
- arrayLength = wordFrames.length;
- if(arrayLength == 0)
- {
- resetArrays();
- }
- else
- {
- var randomNum = Math.floor(Math.random() * arrayLength);
- gotoAndStop(wordFrames[randomNum]);
- usedFrames.push(wordFrames[randomNum]);
- wordFrames.splice(randomNum,1);
- }
- }
- function newRound()
- {
- freebies++;
- guesses = 0;
- badGuesses -= 3;
- if(badGuesses < 0)
- {
- badGuesses = 0;
- }
- letterboxes.gotoAndPlay("showLetters");
- }
- function wonRound()
- {
- alerts.gotoAndPlay("niceJob");
- sound_8.start(0,0);
- flea.gotoAndPlay("sigh");
- deactivateLetterTiles();
- flea.active = true;
- var newTargetY = flea._y - 30;
- if(newTargetY < 100)
- {
- flea.targetY = 100;
- }
- else
- {
- flea.targetY = newTargetY;
- }
- dangerMeter.pin.active = true;
- var newTargetRot = dangerMeter.pin._rotation - 30;
- if(newTargetRot < -65)
- {
- dangerMeter.pin.targetRot = -65;
- }
- else
- {
- dangerMeter.pin.targetRot = newTargetRot;
- }
- }
- function activateLetterTiles()
- {
- var alphabet = ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"];
- var i = 0;
- while(i < 26)
- {
- var letter = alphabet[i];
- gameMC.letterboxes[letter].letterbox.gotoAndPlay("active");
- gameMC.letterboxes.free.letterbox.gotoAndPlay("active");
- i++;
- }
- }
- function deactivateLetterTiles()
- {
- var alphabet = ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"];
- var i = 0;
- while(i < 26)
- {
- var letter = alphabet[i];
- if(gameMC.letterboxes[letter].letterbox._currentframe < 20)
- {
- gameMC.letterboxes[letter].letterbox.gotoAndPlay("inactive");
- }
- if(gameMC.letterboxes.free.letterbox._currentframe < 20)
- {
- gameMC.letterboxes.free.letterbox.gotoAndPlay("inactive");
- }
- i++;
- }
- }
- function useFreebie(me)
- {
- sound_3.start(0,0);
- freeLetter = lettersUp[0];
- letterboxes[freeLetter].gotoAndPlay("pressed");
- letterboxes[freeLetter].letterbox.gotoAndStop("used");
- lettersUp.splice(0,1);
- arrayLength--;
- j = 1;
- while(wordLength >= j)
- {
- if(freeLetter == word1["letter_" + j].myLetter)
- {
- word1["letter_" + j].gotoAndPlay("showLetter");
- word2["letter_" + j].gotoAndPlay("showLetter");
- }
- j++;
- }
- freebies--;
- if(freebies == 0)
- {
- me.gotoAndStop("used");
- me.num.gotoAndStop("inactive");
- }
- }
- function testLetter(whichLetter, me)
- {
- guesses++;
- var gotOne = false;
- var arrayLength = lettersUp.length - 1;
- i = 0;
- while(arrayLength >= i)
- {
- if(whichLetter == lettersUp[i])
- {
- lettersUp.splice(i,1);
- arrayLength--;
- gotOne = true;
- sound_3.start(0,0);
- j = 1;
- while(wordLength >= j)
- {
- if(whichLetter == word1["letter_" + j].myLetter)
- {
- word1["letter_" + j].gotoAndPlay("showLetter");
- word2["letter_" + j].gotoAndPlay("showLetter");
- }
- j++;
- }
- }
- i++;
- }
- if(gotOne == false)
- {
- sound_6.start(0,0);
- badGuesses++;
- if(badGuesses < 13)
- {
- if(10 < badGuesses)
- {
- alerts.gotoAndPlay("danger");
- }
- scareFlea();
- }
- else
- {
- dropFlea();
- }
- }
- me.gotoAndStop("used");
- }
- function scareFlea()
- {
- dangerMeter.pin.active = true;
- dangerMeter.pin.targetRot += 10;
- flea.active = true;
- flea.targetY += 10;
- flea.gotoAndPlay("flinch");
- }
- function dropFlea()
- {
- showerHead.gotoAndPlay("spray");
- deactivateLetterTiles();
- dangerMeter.pin.active = true;
- dangerMeter.pin.targetRot += 10;
- flea.gotoAndPlay("sway");
- tub.gotoAndPlay("splash");
- sound_1.start(0,0);
- }
- function resetGame()
- {
- gotoAndPlay(3);
- alerts.gotoAndPlay("showInstructions");
- tub.gotoAndPlay(1);
- letterboxes.gotoAndPlay(1);
- showerHead.gotoAndPlay(1);
- flea.gotoAndPlay("idle");
- flea.active = true;
- flea.targetY = 100;
- dangerMeter.pin.active = true;
- dangerMeter.pin.targetRot = -65;
- }
- function getScore()
- {
- return score;
- }
- function openHelpWin()
- {
- trace("displaying help");
- gameMC.helpWin_mc.open();
- }
- function closeHelpWin()
- {
- if(1 < helpWindow._currentframe)
- {
- helpWindow.play();
- }
- }
- function pause()
- {
- helpButton.helpButton.enabled = false;
- set("variables:pause",true);
- }
- function unPause()
- {
- helpButton.helpButton.enabled = true;
- set("variables:pause",false);
- }
- function getAdInfo()
- {
- var ad = {id:1,path:"ad1.jpg",link:"http://www.kidswb.com",text:"howdy"};
- return ad;
- }
- function adClick()
- {
- getURL(gameMC.adInfo.link,"");
- }
- function displayAd(ad)
- {
- gameMC.adInfo = ad;
- gameMC.ad_100x100.loadMovie(ad.path);
- }
- function restart()
- {
- containerMC.resetContainer();
- containerMC.init();
- score = 0;
- which_level = 1;
- }
- freebies = 3;
- guesses = 0;
- badGuesses = 0;
- gameMC.createEmptyMovieClip("soundLib",1);
- i = 1;
- while(9 >= i)
- {
- soundLib.createEmptyMovieClip("holder_" + i,i);
- gameMC["sound_" + i] = new Sound(soundLib["holder_" + i]);
- i++;
- }
- sound_1.attachSound("splash");
- sound_2.attachSound("curtain");
- sound_3.attachSound("pop");
- sound_4.attachSound("squeak");
- sound_5.attachSound("whoosh");
- sound_6.attachSound("slideDown");
- sound_7.attachSound("buzzer");
- sound_8.attachSound("slideUp");
- sound_9.attachSound("johnny");
- sound_9.start(0,0);
- if(initGame == null)
- {
- initGame = true;
- containerMC.init();
- displayAd(containerMC.getAdInfo());
- }
-