Framework for games...
Alex Tweedly
alex at tweedly.net
Wed Feb 23 06:13:25 EST 2005
Ian Leigh wrote:
> I intend to learn more about Dreamcard by coding some games and so on.
> I am not sure about the general framework you would use with a setup
> like this though. Normally you end up with a main loop which runs
> continuously, until you quit out of it, and lots of
> methods/subroutines which do all the hard work and are called by the
> main loop or as a consequence of it at some point.
>
> Any tips on the best way to set up a general framework, or any other
> hints or pointers would be muchly appreciated.
>
>
One thing to remember is that in Dreamcard, *most* of the main loop is
already provided in infrastructure and in the "event-driven" nature of
Dreamcard. So although you will likely implement some kind of a loop, it
will probably not be an explicit loop control structure in your code.
Of course, a lot depends on the kind of game, but often you'll have
- a start (new game) button (or menu) which gets the game started,
starts up some timers and starts the actions going
- the timers control other events, including running out of time
- button within the game to stop/abandon the play
- circumstances that you recognize as then end of the play
Then at the "end of the play" you stop all timers and actions, give (or
if it's good, store) the score, etc.
And when the user is ready to start another game - he clicks on your
start button.
So no obvious loop "around the game play".
And within the play, everything is likely to be driven by the timers or
by users actions ...
(Maybe too obvious to say this ..... look at all of the games on
RevOnline in the "Games" category, choose which one looks best to you,
and "be inspired by it" i.e. borrow the code from it.)
--
Alex Tweedly http://www.tweedly.net
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 266.4.0 - Release Date: 22/02/2005
More information about the use-livecode
mailing list