Thread: Set delay?

    #1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    65
    Rep Power
    2

    Set delay?


    how to set up a delay in when makeing a game. is there way to do it without using timer or thead? may be int counter?


    //game loop
    if(...)
    {
    //do stuff
    //wait here for 2 sec
    }
    //go back to top bc of loop
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    May 2007
    Posts
    765
    Rep Power
    929
    Hard to say without knowing (1) what language you are using and (2) what libraries and/or framework you are using. There's usually a "sleep" function that will stop execution of your program for (more or less) a specified time period. However, this may not play nicely with whatever graphics/audio/input/etc. libraries you're using to write your game. You should check your documentation to see what functions are available to you and how they recommend handling timing.
    sub{*{$::{$_}}{CODE}==$_[0]&& print for(%:: )}->(\&Meh);

IMN logo majestic logo threadwatch logo seochat tools logo