Mail Archives: djgpp/1999/08/11/11:11:39
Stefan Viljoen wrote:
>
> <zidharta AT geocities DOT com> wrote in message
> news:7oak28$865$1 AT nnrp1 DOT deja DOT com...
> > how to make my game's background move while the character move
> > according to arrorw keys and sound play at the same time?
> > would it be a multithreading?... how to do this in DOS?
> > I know how to do each of them ... but how do I do this at once?
> > spawning?.. system("start ..")? which one ?
> > thanks in advance ...
>
> I once managed something like this with no fancy stuff like you mention.
> What I did was set up just one loop that has conditionals in it that key to
> differrent speed allegro timers that I set up. For example, to keep the
> character moving, part of my loop checked the "character timer" - when this
> "ticked" I moved the character. Another kept count of how long the current
> song was playing, when it ended the song length timer "ticked" and I started
> up the next song in queue - etc. You can do this to the limit of the amount
> of timers you are able to allocate. You can run through this loop hunderd or
> thousands of times each second, the timers "ticking" at the correct pace to
> keep it all looking real. If you look at any source for almost any DOS games
> that you might be able to find, I think you will see that this is how
> apparent "simultaneous" actions like this was carried out - everything is
> actually done in sequence (HAS to be done in sequence - in a DOS system
> there is usually one processor, one path to memory, one display card, etc.)
> but so fast that it appears simultaneous (i. e. appears to look like
> "multitasking" or multithreading).
>
> Hope this is accurate and helped some!
>
> --
> This message courtesy of
> RylanNet rylan AT intekom DOT co DOT za
> http://home.intekom.com/rylan/
> --
> StarWars for ever!.
More information: In fact, even Windows and the programs that run in it
use this method too; the computer is still only doing one thing at a
time. Each process / thread gets a little bit of time CPU every once in
a while.
moogla
- Raw text -