gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Beginners > How do I do this....

#66997 - Fenderocker - Sat Jan 14, 2006 11:09 pm

I need to put a funtion into my game that makes the computer wait two seconds. It would be something along the lines of:
Code:
do first thing, wait two seconds, do second thing

Thanks!

#67007 - tepples - Sat Jan 14, 2006 11:44 pm

Do something like this:
Code:
/* vblsleep() : wait for roughly vblanks/60 seconds */
int vblsleep(int vblanks)
{
  for(; vblanks > 0; vblanks--)
    VblankIntrWait();
}

int main(void)
{
  do_something();
  vblsleep(120);
  do_something_else();
  while(1) { }
}

_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#67021 - Fenderocker - Sun Jan 15, 2006 12:22 am

thanks!