Sections

  • Search Chrome Cow

Design a Day




The Game Loop

There is no real code for this one, just realization of how to arrange code for a flash game. It looks more or less like this:

// Set up  your variables and inital conditions here

// Variables and Stuff
var gameOn = 1;

// Now Enter the main Game Loop
onEnterFrame = function() {
   
    if ( gameOn == 1) {  // Then do the game loop, set gameOn =0 to stop loop from executing

       // Do all the Game Stuff here

           // To interrupt the loop and send the player somewhere else:
           gameOn = 0;
           gotoAndPlay(some other frame);

    }
}
stop();

Take a look at the code excerpts from the RadialSoloBall and eRadiRace to see this in use.

File Under: , , , ,

Pages: 1 2 3



Share This Post

del.icio.us:Learning Flash digg:Learning Flash spurl:Learning Flash wists:Learning Flash simpy:Learning Flash newsvine:Learning Flash blinklist:Learning Flash furl:Learning Flash reddit:Learning Flash fark:Learning Flash blogmarks:Learning Flash Y!:Learning Flash smarking:Learning Flash magnolia:Learning Flash segnalo:Learning Flash Submit to Slashdot Submit to BoingBoing Submit to Make


One Response to “Learning Flash”

  1. Box3r Says:


    nice 1

Leave a Reply

Comment Preview




All comments are subject to the Rules.