Nemo's Revenge

Ultimate flash games


About us

7/03/07

This site was created by three freinds.  We are taking a macromedia flash camp and we are making some pretty cool games.  Matt changed the game snake so there is a bunch of geese eating pizza.  I (George) made a lot of images and movies.  Owen wrote the code for the more complicated games.  He made this script for simon:

var dim = 50;  //Alpha of pieces when clicked
aPieces = new Array(); //Array of pieces
aMoveList = new Array(); //Array of moves made
var ID;
var count = 0; //Number of moves made
var one;
var soSound0 = new Sound(this); //Creates a new Sound
soSound0.attachSound("simonSound1.mp3"); //Attaches simonSound1.mp3 to that sound
var soSound1 = new Sound(this);
soSound1.attachSound("simonSound2.mp3");
var soSound2 = new Sound(this);
soSound2.attachSound("simonSound3.mp3");
var soSound3 = new Sound(this);
soSound3.attachSound("simonSound4.mp3");
var step = 0;
for (var i = 1; i < 5; i++) //Adds the four movie clip quadrants to aPieces
{
        aPieces.push(this["m" + i]);
        this["m" + i].value = i - 1;
}
function buildPieces()
{
        for (var i = 0; i < aPieces.length; i++)
        {
                aPieces[i].onPress = function() //When the piece is pressed it dims
                {
                        this._alpha = dim;
                };
                aPieces[i].onRollOut = function() //When you roll your mouse off of the piece it undims
                {
                        this._alpha = 100;
                };
                aPieces[i].onRelease = function()  //When you release your mouse
                {
                        this._alpha = 100;  //Set transparency to 100%
                        _root["soSound" + this.value].start(0); //Play the piece sound
                        if (aMoveList[step] != this.value) //If the piece you pressed does not equal the piece you were supposed to press
                        {
                                failure(); //failure method
                                return;
                        }
                        step++; //Add one to the amount of steps to do
                        if (step == aMoveList.length)
                        {
                                nextLevel();  //Go to the next level
                        }
                };
        }
}
function failure()
{
        tMainText.text = "Game Over.";
        killPieces();
        mStart._alpha = 100;  //Set start button transparency back to 100%
        aMoveList = new Array();  //Delete array of moves
        mStart.onRelease = function()  //Recreate the start button
        {
                startGame();
        }
}
function killPieces()
{
        for (var i = 0; i < aPieces.length; i++) //Deletes all the functions of the pieces so you cant interact with them
        {
                delete aPieces[i].onPress;
                delete aPieces[i].onRollOut;
                delete aPieces[i].onRelease;
        }
}
function lightUp(num)
{
        clearInterval(ID);
        count--;
        if (count == 0)  //If no more pieces are left to light up, wait for user to input sequence
        {
                userTurn();
                return;
        }
        if (count == 1) //If the last piece in the list has just been lit up, pick a random light to light up
        {
                num = Math.floor(Math.random() * 4);
        }
        else //Set num to the next light to light up
        {
                num = aMoveList[aMoveList.length + 1 - count];
        }
        light(num); //Light up the light
}
function userTurn()
{
        step = 0; //Sets the step to 0
        buildPieces();  //Lets user interact with pieces
}
function light(num)
{
        dimIt(num); //dims the num piece
        ID = setInterval(pause, 500, num); //Light up the piece for half of a second
}
function pause(num)
{
        clearInterval(ID);
        unDim(num);
        ID = setInterval(lightUp, 50, num); //Creates a 50ms pause between lighting up pieces
}
function dimIt(num)
{
        if (count == 1)
        {
                aMoveList.push(num);
        }
        _root["soSound" + num].start(0); //Plays the sound when lighting a piece up
        aPieces[num]._alpha = 50;
}
function unDim(num)
{
        aPieces[num]._alpha = 100;
}
function startGame()
{
        one = Math.floor(Math.random() * 4) //Picks one piece
        tMainText.text = ""; //Sets the text field to display nothing
        for (var i = 0; i < aPieces.length; i++)
        {
                aPieces[i]._alpha = 100; //Sets all the pieces to 100% transparency
        }
        mStart._alpha = 0; //Sets the start button to invisible
        delete mStart.onRelease; //Deletes the start button onRelease function
        buildPieces();
        count = 1;
        light(one); //Lights one piece
}
function nextLevel()
{
        killPieces(); //Disables interacting with pieces
        for (var i = 0; i < aPieces.length; i++)
        {
                aPieces[i]._alpha = 100; //Sets all pieces to 100% transparency
        }
        count = aMoveList.length + 1;
        var timer = getTimer();
        this.onEnterFrame = function()
        {
                if (timer < getTimer() - 1000) //Wait 1 second before starting sequence display after input
                {
                        delete this.onEnterFrame;
                        light(one);
                }
        };
}
mStart.onRelease = function()
{
        startGame();
};

That is for a game of simon.

THANKS FOR THE HELP BCCC  (Bucks county community college)

Flash version used

At camp- Macromedia Flash 8

At home:

George- Adobe Flash 9

Owen- Adobe Flash 9

Matt- Macromedia Flash MX 2004

 

-GOM

 

Create a free website at Webs.com