Mail Archives: djgpp/1997/01/28/17:41:42
Can anyone help me with setting up timers in Allegro so that my game
events respond to the timer. So far I was using an old method I used with
BC++:
.
.
rest(10);
my_timer++;
//i want some event to occur every 6th irritation
if (my_timer % 6 == 0) {do some stuff;}
//other stuff every 11th
if (my_timer % 11 == 0) {some other stuff;}
.
.
However this worked fine if the program did not do a lot of computing, but
now I got a program that does a lot of computing and this makes slow
computers run the program at different times, which is really not how the
game should work.
Is there some way in Allegro that I can achieve the same thing, I tried
similar thing setting timer to 10ms, and then using timer%6, but this
failed in some cases because the timer var is being updated by an
interrupt and the program was missing some irritations of timer%6.
Can anyone help me with setting the program to respond to timer.
Thanks in advance!!!
- Raw text -