daily pastebin goal
5%
SHARE
TWEET

Untitled

a guest Jan 18th, 2019 50 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Outside of any functions...
  2. double lastBlinkTime;
  3. static const double blinkInterval = 500;
  4.  
  5. // A function that is called once at the start of the game...
  6. void Init()
  7. {
  8.     lastBlinkTime = 0.0; // Or you can use the current time, doesn't matter really at this point
  9. }
  10.  
  11. // A function that is called every frame
  12. void Update()
  13. {
  14.     // Here you should use whatever you have available to get the current time in ms
  15.     double curTime = getCurrentTimeInMilliseconds();
  16.  
  17.     if(curTime > lastBlinkTime + blinkInterval)
  18.     {
  19.         lastBlinkTime = curTime;
  20.  
  21.         // Do whatever blinking code you need to here.
  22.     }
  23. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top