How would a game loop work?
sarahr at genesearch.com.au
Thu Aug 18 18:49:10 CDT 2005
> What strikes me about rev is that it's harder to manage a flow of
> things from a main loop. For example, a game might have a
> particular loop for overall control which steps through all the
> required stages and then draws a new frame, starting the whole
> thing off again. How would you best manage a game in rev? Would you
> have a loop off a 'start game' button which could only be
> interrupted by the quit action? Just wondering how others have
> approached laying out games and such programs?
I would use the "send in time" structure. Have your main game loop in
a single handler. Starting the game would call this main loop, which
could look something like this:
-- draw screen etc
send "mainGameLoop" to me in 1 tick
The "send" command is non-clocking, so any user input can be seen &
processed in other handlers or scripts, while the main loop keeps
happening effectively in the background.
Scott Rossi at Tactile Media has some excellent examples of this.
More information about the use-livecode